Added Xerces-C++ 3.1.2
This commit is contained in:
@@ -0,0 +1,846 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE MsgFile SYSTEM "../XMLErrList.dtd">
|
||||
|
||||
<!--
|
||||
|
||||
This message file contains all errors, warnings, and exception
|
||||
messages used by Xerces-C++. If you ever need to add another
|
||||
message make sure you follow these guidelines:
|
||||
|
||||
- All messages start with a lower-case letter (except where
|
||||
a name is used as the first word) and do not have a period
|
||||
at the end.
|
||||
|
||||
- Names of elements, attributes, types, files, etc., as well as
|
||||
values should be enclosed in '', for example:
|
||||
|
||||
"invalid value '{0}' for whiteSpace facet; expected 'collapse'"
|
||||
|
||||
"imported schema '{0}' has a different target namespace '{1}';
|
||||
expected '{2}'"
|
||||
|
||||
Qualified names of constructs should not be enclosed in '', for
|
||||
example:
|
||||
|
||||
"whiteSpace facet", not "'whiteSpace' facet"
|
||||
"choice compositor", not "'choice' compositor"
|
||||
|
||||
- All messages should be in single-sentence format (that is there,
|
||||
should be no periods in the message). If you need to provide
|
||||
additional information use ';', for example:
|
||||
|
||||
"'{0}' is not allowed for the content of simpleType; only list,
|
||||
union, and restriction are allowed"
|
||||
|
||||
|
||||
- If the same message is provided for more that one construct
|
||||
(e.g., for element and attribute), make sure that the same
|
||||
working is used in all places.
|
||||
|
||||
- Use plain English and try to avoid starting sentences with "if",
|
||||
"when", etc. For example:
|
||||
|
||||
|
||||
Bad: "if the namespace on an import element is not present,
|
||||
the importing schema must have a target namespace"
|
||||
|
||||
Better: "importing schema must have target namespace if namespace
|
||||
in import declaration is not present"
|
||||
|
||||
- Study similar messages to the one you are adding and make sure
|
||||
you use consistent terminology.
|
||||
|
||||
A Message file is designed for a particular locale, which is
|
||||
indicated in the locale attribute below.
|
||||
|
||||
-->
|
||||
|
||||
<MsgFile Locale="EN_US">
|
||||
<MsgDomain Domain="http://apache.org/xml/messages/XMLErrors">
|
||||
<Warning>
|
||||
<Message Id="NotationAlreadyExists" Text="notation '{0}' has already been declared"/>
|
||||
<Message Id="AttListAlreadyExists" Text="attribute '{0}' has already been declared for element '{1}'"/>
|
||||
<Message Id="ContradictoryEncoding" Text="encoding '{0}' from XML declaration or manually set contradicts the auto-sensed encoding; ignoring"/>
|
||||
<Message Id="UndeclaredElemInCM" Text="element '{0}' is referenced in a content model but was never declared"/>
|
||||
<Message Id="UndeclaredElemInAttList" Text="element '{0}' is referenced in an ATTLIST but was never declared"/>
|
||||
<Message Id="XMLException_Warning" Text="{0}"/>
|
||||
<Message Id="XIncludeResourceErrorWarning" Text="unable to include document '{0}'"/>
|
||||
<Message Id="XIncludeCannotOpenFile" Text="unable to open text file target '{0}'"/>
|
||||
<Message Id="XIncludeIncludeFailedResourceError" Text="unable to include resource '{0}'"/>
|
||||
</Warning>
|
||||
<Error>
|
||||
<Message Id="FeatureUnsupported" Text="'{0}' is not allowed for the content of simpleType; only list, union, and restriction are allowed"/>
|
||||
<Message Id="TopLevelNoNameComplexType" Text="globally-defined complex type must have a name"/>
|
||||
<Message Id="TopLevelNoNameAttribute" Text="globally-declared attribute must have a name"/>
|
||||
<Message Id="NoNameRefAttribute" Text="attribute declaration must have name or 'ref' attribute"/>
|
||||
<Message Id="NoNameRefElement" Text="element declaration must have name or 'ref' attribute"/>
|
||||
<Message Id="NoNameRefGroup" Text="group declaration must have name or a 'ref' attribute"/>
|
||||
<Message Id="NoNameRefAttGroup" Text="attributeGroup declaration must have name or 'ref' attribute"/>
|
||||
<Message Id="AnonComplexTypeWithName" Text="anonymous complexType in element '{0}' has name"/>
|
||||
<Message Id="AnonSimpleTypeWithName" Text="anonymous simpleType in element '{0}' has name"/>
|
||||
<Message Id="InvalidElementContent" Text="content of element declaration must match (annotation?, (simpleType | complexType)?, (unique | key | keyref)*)"/>
|
||||
<Message Id="SimpleTypeContentError" Text="invalid content in simple type '{0}'; only list, union, and restriction are allowed"/>
|
||||
<Message Id="ExpectedSimpleTypeInList" Text="expected simpleType in list definition for type '{0}'"/>
|
||||
<Message Id="ListUnionRestrictionError" Text="list, union, or restriction content is invalid for type '{0}'"/>
|
||||
<Message Id="SimpleTypeDerivationByListError" Text="invalid content in list definition for type '{0}'"/>
|
||||
<Message Id="ExpectedSimpleTypeInRestriction" Text="expected simpleType in restriction definition for type '{0}'"/>
|
||||
<Message Id="DuplicateFacet" Text="facet '{0}' is already defined"/>
|
||||
<Message Id="ExpectedSimpleTypeInUnion" Text="expected simpleType in union definition for type '{0}'"/>
|
||||
<Message Id="EmptySimpleTypeContent" Text="content in simpleType definition is empty"/>
|
||||
<Message Id="InvalidSimpleContent" Text="expected restriction or extension in simpleContent definition"/>
|
||||
<Message Id="UnspecifiedBase" Text="base attribute must be specified for restriction or extension definition"/>
|
||||
<Message Id="InvalidComplexContent" Text="expected restriction or extension in complexContent definition"/>
|
||||
<Message Id="SchemaElementContentError" Text="invalid content in 'schema' element"/>
|
||||
<Message Id="ContentError" Text="invalid content for type '{0}'"/>
|
||||
<Message Id="UnknownSimpleType" Text="unknown simpleType '{0}'"/>
|
||||
<Message Id="UnknownComplexType" Text="unknown complexType '{0}'"/>
|
||||
<Message Id="UnresolvedPrefix" Text="prefix '{0}' can not be resolved to namespace URI"/>
|
||||
<Message Id="RefElementNotFound" Text="referenced element '{0}' not found"/>
|
||||
<Message Id="TypeNotFound" Text="type '{0}:{1}' not found"/>
|
||||
<Message Id="TopLevelAttributeNotFound" Text="attribute '{0}' not found"/>
|
||||
<Message Id="InvalidChildInComplexType" Text="invalid element '{0}' in complex type definition"/>
|
||||
<Message Id="BaseTypeNotFound" Text="base type '{0}' not found"/>
|
||||
<Message Id="DatatypeValidatorCreationError" Text="unable to create validator for '{0}'"/>
|
||||
<Message Id="InvalidChildFollowingSimpleContent" Text="invalid element following simpleContent definition in complexType"/>
|
||||
<Message Id="InvalidChildFollowingConplexContent" Text="invalid element following complexContent definition in complexType"/>
|
||||
<Message Id="AttributeDefaultFixedValue" Text="attribute '{0}' cannot have both fixed and default values"/>
|
||||
<Message Id="NotOptionalDefaultAttValue" Text="attribute '{0}' with default value must be optional"/>
|
||||
<Message Id="DuplicateAttribute" Text="attribute '{0}' declared more than once in the same scope"/>
|
||||
<Message Id="AttributeWithTypeAndSimpleType" Text="attribute '{0}' cannot have both 'type' attribute and simpleType definition"/>
|
||||
<Message Id="AttributeSimpleTypeNotFound" Text="simpleType '{0}:{1}' for attribute '{2}' not found"/>
|
||||
<Message Id="ElementWithFixedAndDefault" Text="element '{0}' cannot have both fixed and default values"/>
|
||||
<Message Id="InvalidDeclarationName" Text="invalid {0} name '{1}'"/>
|
||||
<Message Id="ElementWithTypeAndAnonType" Text="element '{0}' cannot have both 'type' attribute and simpleType/complexType definition"/>
|
||||
<Message Id="NotSimpleOrMixedElement" Text="element '{0}' has fixed or default value and must have mixed simple or simple content model"/>
|
||||
<Message Id="DisallowedSimpleTypeExtension" Text="simpleType '{0}' that '{1}' extends has a value of the final attribute that does not permit extension"/>
|
||||
<Message Id="InvalidSimpleContentBase" Text="type '{0}' specified as the base in simpleContent definition must not have complex content"/>
|
||||
<Message Id="InvalidComplexTypeBase" Text="type '{0}' is a simple type and cannot be used in derivation by restriction in complexType definition"/>
|
||||
<Message Id="InvalidChildInSimpleContent" Text="invalid element following restriction or extension definition in simpleContent"/>
|
||||
<Message Id="InvalidChildInComplexContent" Text="invalid element following restriction or extension definition in complexContent"/>
|
||||
<Message Id="AnnotationError" Text="duplicate annotation in type '{0}'"/>
|
||||
<Message Id="DisallowedBaseDerivation" Text="type '{0}' cannot be used in its own union, list, or restriction definition"/>
|
||||
<Message Id="InvalidBlockValue" Text="block value '{0}' is invalid"/>
|
||||
<Message Id="InvalidFinalValue" Text="final value '{0}' is invalid"/>
|
||||
<Message Id="InvalidSubstitutionGroupElement" Text="element '{0}' cannot be part of the substitution group headed by '{1}'"/>
|
||||
<Message Id="SubstitutionGroupTypeMismatch" Text="element '{0}' has a type which does not derive from the type of the element at the head of the substitution group"/>
|
||||
<Message Id="DuplicateElementDeclaration" Text="element '{0}' declared more than once in the same scope"/>
|
||||
<Message Id="InvalidAttValue" Text="value '{0}' invalid for attribute '{1}'"/>
|
||||
<Message Id="AttributeRefContentError" Text="attribute '{0}' has both 'ref' attribute and inline simpleType definition or 'form' or 'type' attribute"/>
|
||||
<Message Id="DuplicateRefAttribute" Text="duplicate reference attribute '{0}:{1}' in complexType definition"/>
|
||||
<Message Id="ForbiddenDerivationByRestriction" Text="derivation by restriction is forbidden by either base type '{0}' or globally"/>
|
||||
<Message Id="ForbiddenDerivationByExtension" Text="derivation by extension is forbidden by either base type '{0}' or globally"/>
|
||||
<Message Id="BaseNotComplexType" Text="base type specified in complexContent definition must be a complex type"/>
|
||||
<Message Id="ImportNamespaceDifference" Text="imported schema '{0}' has different target namespace '{1}'; expected '{2}'"/>
|
||||
<Message Id="DeclarationNoSchemaLocation" Text="'schemaLocation' attribute must be specified in element '{0}'"/>
|
||||
<Message Id="IncludeNamespaceDifference" Text="included schema '{0}' has different target namespace '{1}'"/>
|
||||
<Message Id="OnlyAnnotationExpected" Text="at most one annotation is allowed"/>
|
||||
<Message Id="InvalidAttributeContent" Text="content of attribute '{0}' must match (annotation?, simpleType?)"/>
|
||||
<Message Id="AttributeRequiredGlobal" Text="attribute '{0}' must appear in global {1} declarations"/>
|
||||
<Message Id="AttributeRequiredLocal" Text="attribute '{0}' must appear in local {1} declarations"/>
|
||||
<Message Id="AttributeDisallowedGlobal" Text="attribute '{0}' cannot appear in global {1} declarations"/>
|
||||
<Message Id="AttributeDisallowedLocal" Text="attribute '{0}' cannot appear in local {1} declarations"/>
|
||||
<Message Id="InvalidMin2MaxOccurs" Text="minOccurs value '{0}' must not be greater than maxOccurs value '{1}'"/>
|
||||
<Message Id="AnyAttributeContentError" Text="duplicate annotation in anyAttribute declaration"/>
|
||||
<Message Id="NoNameGlobalElement" Text="global {0} declaration must have name"/>
|
||||
<Message Id="NoCircularDefinition" Text="circular definition in '{0}'"/>
|
||||
<Message Id="DuplicateGlobalType" Text="global type '{0}:{1}' declared more than once or also declared as {2}"/>
|
||||
<Message Id="DuplicateGlobalDeclaration" Text="global {0} '{1}' declared more than once"/>
|
||||
<Message Id="WS_CollapseExpected" Text="invalid value '{0}' for whiteSpace facet; expected 'collapse'"/>
|
||||
<Message Id="Import_1_1" Text="namespace of import declaration must be different from target namespace of importing schema"/>
|
||||
<Message Id="Import_1_2" Text="importing schema must have target namespace if namespace in import declaration is not present"/>
|
||||
<Message Id="ElemIDValueConstraint" Text="element '{0}' cannot have value constraint '{1}' if its type is derived from ID"/>
|
||||
<Message Id="NoNotationType" Text="element/attribute '{0}' is of NOTATION type"/>
|
||||
<Message Id="EmptiableMixedContent" Text="element '{0}' has mixed content type and the content type's particle must be emptiable"/>
|
||||
<Message Id="EmptyComplexRestrictionDerivation" Text="complexType definition has empty content but base type is not empty or does not have emptiable particle"/>
|
||||
<Message Id="MixedOrElementOnly" Text="content types of base type '{0}' and derived type '{1}' must both be mixed or element-only"/>
|
||||
<Message Id="InvalidContentRestriction" Text="derived content type is not a valid restriction of base content type"/>
|
||||
<Message Id="ForbiddenDerivation" Text="derivation by extension or restriction is forbidden by either base type '{0}' or globally"/>
|
||||
<Message Id="AtomicItemType" Text="item type definition must have variety of atomic or union where all member types must be atomic"/>
|
||||
<Message Id="GroupContentError" Text="group '{0}' must contain all, choice, or sequence compositor"/>
|
||||
<Message Id="AttGroupContentError" Text="content of attributeGroup '{0}' must match (annotation?, ((attribute | attributeGroup)*, anyAttribute?))"/>
|
||||
<Message Id="MinMaxOnGroupChild" Text="top-level compositor in a group must not have 'minOccurs' or 'maxOccurs' attribute"/>
|
||||
<Message Id="DeclarationNotFound" Text="{0} '{1}:{2}' not found"/>
|
||||
<Message Id="AllContentLimited" Text="group with the all compositor must only appear as content type of a complex type"/>
|
||||
<Message Id="BadMinMaxAllCT" Text="group with the all compositor constituting the content type of a complex type must have both minOccurs and maxOccurs equal 1"/>
|
||||
<Message Id="BadMinMaxAllElem" Text="element declaration in the all compositor must have minOccurs and maxOccurs equal 0 or 1"/>
|
||||
<Message Id="DuplicateAttInDerivation" Text="attribute '{0}' is already defined in base"/>
|
||||
<Message Id="NotExpressibleWildCardIntersection" Text="intensional intersection of attribute wildcards must be expressible"/>
|
||||
<Message Id="BadAttDerivation_1" Text="base type does not have any attributes"/>
|
||||
<Message Id="BadAttDerivation_2" Text="attribute '{0}' has incompatible use value in the base"/>
|
||||
<Message Id="BadAttDerivation_3" Text="type of attribute '{0}' must be derived by restriction from type of the corresponding attribute in the base"/>
|
||||
<Message Id="BadAttDerivation_4" Text="attribute '{0}' does not have a fixed value or has a different fixed value from that of the base"/>
|
||||
<Message Id="BadAttDerivation_5" Text="attribute '{0}' has invalid target namespace with respect to the base wildcard constraint or base has no wildcard"/>
|
||||
<Message Id="BadAttDerivation_6" Text="attribute wildcard is present in the derived type but not in the base"/>
|
||||
<Message Id="BadAttDerivation_7" Text="attribute wildcard in the derived type is not a valid subset of that in the base"/>
|
||||
<Message Id="BadAttDerivation_8" Text="attribute '{0}' cannot have different use value in the derived type if the base attribute use value is 'prohibited'"/>
|
||||
<Message Id="BadAttDerivation_9" Text="attribute wildcard in the derived type must be identical to or stricter than the one in the base"/>
|
||||
<Message Id="AllContentError" Text="unexpected '{0}' in the content of the all compositor; only elements are allowed"/>
|
||||
<Message Id="RedefineNamespaceDifference" Text="redefined schema '{0}' has a different target namespace '{1}'"/>
|
||||
<Message Id="Redefine_InvalidSimpleType" Text="simpleType in redefine must have a restriction definition"/>
|
||||
<Message Id="Redefine_InvalidSimpleTypeBase" Text="simpleType base attribute in redefine must reference the original type with the same name"/>
|
||||
<Message Id="Redefine_InvalidComplexType" Text="complexType in redefine must have a restriction or extension definition"/>
|
||||
<Message Id="Redefine_InvalidComplexTypeBase" Text="complexType base attribute in redefine must reference the original type with the same name"/>
|
||||
<Message Id="Redefine_InvalidGroupMinMax" Text="group '{0}' must have minOccurs and maxOccurs equal 1"/>
|
||||
<Message Id="Redefine_DeclarationNotFound" Text="unable to find declaration in the schema being redefined corresponding to '{0}'"/>
|
||||
<Message Id="Redefine_GroupRefCount" Text="group declaration in redefine may only contain one reference to itself"/>
|
||||
<Message Id="Redefine_AttGroupRefCount" Text="attributeGroup declaration in redefine may only contain one reference to itself"/>
|
||||
<Message Id="Redefine_InvalidChild" Text="redefine declaration cannot contain '{0}'"/>
|
||||
<Message Id="Notation_DeclNotFound" Text="notation declaration '{0}:{1}' not found"/>
|
||||
<Message Id="IC_DuplicateDecl" Text="more than one identity constraint has name '{0}'"/>
|
||||
<Message Id="IC_BadContent" Text="identity constraint declaration must match (annotation?, selector, field+)"/>
|
||||
<Message Id="IC_KeyRefReferNotFound" Text="key reference declaration '{0}' refers to unknown key '{1}'"/>
|
||||
<Message Id="IC_KeyRefCardinality" Text="field cardinalities for keyref '{0}' and key '{1}' must match"/>
|
||||
<Message Id="IC_XPathExprMissing" Text="XPath expression is missing or empty"/>
|
||||
<Message Id="AttUseCorrect" Text="fixed value in attribute reference is not set or differs from the fixed value of '{0}'"/>
|
||||
<Message Id="AttDeclPropCorrect3" Text="attribute '{0}' is of ID type or type derived from ID and cannot have default/fixed value constraint"/>
|
||||
<Message Id="AttDeclPropCorrect5" Text="attribute '{0}' is a subsequent attribute in this complex type with a type derived from ID"/>
|
||||
<Message Id="AttGrpPropCorrect3" Text="attribute '{0}' is a subsequent attribute in this attribute group with a type derived from ID"/>
|
||||
<Message Id="InvalidTargetNSValue" Text="empty value illegal for 'targetNamespace' attribute; target namespace must be absent or contain non-empty value"/>
|
||||
<Message Id="XMLException_Error" Text="{0}"/>
|
||||
<Message Id="InvalidRedefine" Text="'{0}' has already been included or redefined"/>
|
||||
<Message Id="InvalidNSReference" Text="namespace '{0}' is referenced without import declaration"/>
|
||||
<Message Id="NotAllContent" Text="all compositor that is part of a complex type definition must constitute the entire content of the definition"/>
|
||||
<Message Id="InvalidAnnotationContent" Text="annotation can only contain appinfo and documentation declarations"/>
|
||||
<Message Id="InvalidFacetName" Text="invalid facet name '{0}'"/>
|
||||
<Message Id="InvalidXMLSchemaRoot" Text="root element name of XML Schema document must be 'schema'"/>
|
||||
<Message Id="CircularSubsGroup" Text="circular substitution group in element '{0}'"/>
|
||||
<Message Id="ELTSchemaNS" Text="element '{0}' must be from the XML Schema namespace"/>
|
||||
<Message Id="InvalidAttTNS" Text="target namespace of attribute '{0}' cannot be http://www.w3.org/2001/XMLSchema-instance"/>
|
||||
<Message Id="NSDeclInvalid" Text="invalid namespace declaration"/>
|
||||
<Message Id="DOMLevel1Node" Text="namespace fix-up cannot be performed on DOM Level 1 node"/>
|
||||
<Message Id="DuplicateAnyAttribute" Text="more than one anyAttribute declaration found in complex type declaration"/>
|
||||
<Message Id="AnyAttributeBeforeAttribute" Text="anyAttribute must not be followed by other declarations"/>
|
||||
</Error>
|
||||
<FatalError>
|
||||
<Message Id="EntityExpansionLimitExceeded" Text= "parser has encountered more than '{0}' entity expansions in the document; this is the limit imposed by the application"/>
|
||||
<Message Id="ExpectedCommentOrCDATA" Text="expected comment or CDATA section"/>
|
||||
<Message Id="ExpectedAttrName" Text="attribute name expected"/>
|
||||
<Message Id="ExpectedNotationName" Text="notation name expected"/>
|
||||
<Message Id="NoRepInMixed" Text="illegal repetition of elements in mixed content model"/>
|
||||
<Message Id="ExpectedDefAttrDecl" Text="default attribute declaration expected"/>
|
||||
<Message Id="ExpectedEqSign" Text="equal sign expected"/>
|
||||
<Message Id="ExpectedElementName" Text="element name expected"/>
|
||||
<Message Id="CommentsMustStartWith" Text="comment must start with <!--"/>
|
||||
<Message Id="InvalidDocumentStructure" Text="invalid document structure"/>
|
||||
<Message Id="ExpectedDeclString" Text="expected version, encoding, or standalone declaration"/>
|
||||
<Message Id="BadXMLVersion" Text="invalid XML version declaration"/>
|
||||
<Message Id="UnsupportedXMLVersion" Text="unsupported XML version '{0}'"/>
|
||||
<Message Id="UnterminatedXMLDecl" Text="unterminated XML declaration"/>
|
||||
<Message Id="BadXMLEncoding" Text="invalid XML encoding declaration '{0}'"/>
|
||||
<Message Id="BadStandalone" Text="invalid standalone declaration"/>
|
||||
<Message Id="UnterminatedComment" Text="unterminated comment"/>
|
||||
<Message Id="PINameExpected" Text="processing instruction name expected"/>
|
||||
<Message Id="UnterminatedPI" Text="unterminated processing instruction"/>
|
||||
<Message Id="InvalidCharacter" Text="invalid character 0x{0}"/>
|
||||
<Message Id="UnterminatedStartTag" Text="unterminated start tag '{0}'"/>
|
||||
<Message Id="ExpectedAttrValue" Text="attribute value expected"/>
|
||||
<Message Id="UnterminatedEndTag" Text="unterminated end tag '{0}'"/>
|
||||
<Message Id="ExpectedAttributeType" Text="expected type for attribute '{0}' of element '{1}'"/>
|
||||
<Message Id="ExpectedEndOfTagX" Text="expected end of tag '{0}'"/>
|
||||
<Message Id="ExpectedMarkup" Text="expected tag name, comment, PI, or other markup"/>
|
||||
<Message Id="NotValidAfterContent" Text="invalid content after root element's end tag"/>
|
||||
<Message Id="ExpectedComment" Text="comment expected"/>
|
||||
<Message Id="ExpectedCommentOrPI" Text="comment or processing instruction expected"/>
|
||||
<Message Id="ExpectedWhitespace" Text="whitespace expected"/>
|
||||
<Message Id="NoRootElemInDOCTYPE" Text="expected root element in DOCTYPE declaration"/>
|
||||
<Message Id="ExpectedQuotedString" Text="quoted string expected"/>
|
||||
<Message Id="ExpectedPublicId" Text="public id expected"/>
|
||||
<Message Id="InvalidPublicIdChar" Text="invalid character 0x{0} in public id"/>
|
||||
<Message Id="UnterminatedDOCTYPE" Text="unterminated DOCTYPE declaration"/>
|
||||
<Message Id="InvalidCharacterInIntSubset" Text="invalid character 0x{0} in internal subset"/>
|
||||
<Message Id="UnexpectedWhitespace" Text="unexpected whitespace"/>
|
||||
<Message Id="InvalidCharacterInAttrValue" Text="invalid character 0x{1} in attribute value '{0}'"/>
|
||||
<Message Id="ExpectedMarkupDecl" Text="markup declaration expected"/>
|
||||
<Message Id="TextDeclNotLegalHere" Text="TEXT declaration is illegal at this point"/>
|
||||
<Message Id="ConditionalSectInIntSubset" Text="conditional section in internal subset"/>
|
||||
<Message Id="ExpectedPEName" Text="parameter entity name expected"/>
|
||||
<Message Id="UnterminatedEntityDecl" Text="unterminated entity declaration '{0}'"/>
|
||||
<Message Id="InvalidCharacterRef" Text="invalid character reference"/>
|
||||
<Message Id="UnterminatedCharRef" Text="unterminated character reference"/>
|
||||
<Message Id="ExpectedEntityRefName" Text="expected entity name for reference"/>
|
||||
<Message Id="EntityNotFound" Text="entity '{0}' not found"/>
|
||||
<Message Id="NoUnparsedEntityRefs" Text="unparsed entity reference '{0}' is invalid at this point"/>
|
||||
<Message Id="UnterminatedEntityRef" Text="unterminated entity reference '{0}'"/>
|
||||
<Message Id="RecursiveEntity" Text="recursive entity expansion '{0}'"/>
|
||||
<Message Id="PartialMarkupInEntity" Text="partial markup in entity value"/>
|
||||
<Message Id="UnterminatedElementDecl" Text="unterminated element declaration '{0}'"/>
|
||||
<Message Id="ExpectedContentSpecExpr" Text="expected content specification for element '{0}'"/>
|
||||
<Message Id="ExpectedAsterisk" Text="'*' expected"/>
|
||||
<Message Id="UnterminatedContentModel" Text="mixed content model '{0}' not terminated properly"/>
|
||||
<Message Id="ExpectedSystemOrPublicId" Text="system or public id expected"/>
|
||||
<Message Id="UnterminatedNotationDecl" Text="unterminated notation declaration"/>
|
||||
<Message Id="ExpectedSeqChoiceLeaf" Text="expected ',', '|', or ')'"/>
|
||||
<Message Id="ExpectedChoiceOrCloseParen" Text="expected '|' or ')'"/>
|
||||
<Message Id="ExpectedSeqOrCloseParen" Text="expected ',', '|', or ')' in content model of element '{0}'"/>
|
||||
<Message Id="ExpectedEnumValue" Text="expected enumeration value for attribute '{0}'"/>
|
||||
<Message Id="ExpectedEnumSepOrParen" Text="expected '|' or ')'"/>
|
||||
<Message Id="UnterminatedEntityLiteral" Text="unterminated entity literal"/>
|
||||
<Message Id="MoreEndThanStartTags" Text="unmatched end tag detected"/>
|
||||
<Message Id="ExpectedOpenParen" Text="'(' expected"/>
|
||||
<Message Id="AttrAlreadyUsedInSTag" Text="attribute '{0}' is already specified for element '{1}'"/>
|
||||
<Message Id="BracketInAttrValue" Text="'<' character cannot be used in attribute value '{0}'; use &lt; instead"/>
|
||||
<Message Id="Expected2ndSurrogateChar" Text="leading surrogate character is not followed by a legal second character"/>
|
||||
<Message Id="ExpectedEndOfConditional" Text="expected ']]>' sequence to end conditional section"/>
|
||||
<Message Id="ExpectedIncOrIgn" Text="expected INCLUDE or IGNORE at this point"/>
|
||||
<Message Id="ExpectedINCLUDEBracket" Text="expected '[' to follow INCLUDE or IGNORE"/>
|
||||
<Message Id="UnexpectedEOE" Text="unexpected end of entity '{0}'"/>
|
||||
<Message Id="PEPropogated" Text="parameter entity propagated out of internal/external subset"/>
|
||||
<Message Id="ExtraCloseSquare" Text="unmatched ']' character detected"/>
|
||||
<Message Id="PERefInMarkupInIntSubset" Text="parameter entity references are not allowed inside markup in internal subset"/>
|
||||
<Message Id="EntityPropogated" Text="entity propagated out of the content section into miscellaneous"/>
|
||||
<Message Id="ExpectedNumericalCharRef" Text="expected &# to be followed by a numeric character value"/>
|
||||
<Message Id="ExpectedOpenSquareBracket" Text="'[' expected"/>
|
||||
<Message Id="BadSequenceInCharData" Text="']]>' sequence is not allowed in character data"/>
|
||||
<Message Id="IllegalSequenceInComment" Text="'--' sequence is illegal in comment"/>
|
||||
<Message Id="UnterminatedCDATASection" Text="unterminated CDATA section"/>
|
||||
<Message Id="ExpectedNDATA" Text="NDATA expected"/>
|
||||
<Message Id="NDATANotValidForPE" Text="NDATA is illegal for parameter entities"/>
|
||||
<Message Id="HexRadixMustBeLowerCase" Text="hex radix character references must use 'x', not 'X'"/>
|
||||
<Message Id="DeclStringRep" Text="{0} declaration already seen"/>
|
||||
<Message Id="DeclStringsInWrongOrder" Text="XML declarations must be in this order: version, encoding, standalone"/>
|
||||
<Message Id="NoExtRefsInAttValue" Text="external entity cannot be referred to from attribute value"/>
|
||||
<Message Id="XMLDeclMustBeLowerCase" Text="XML or TEXT declaration must start with '<?xml ', not '<?XML '"/>
|
||||
<Message Id="ExpectedEntityValue" Text="expected literal entity value or public/system id"/>
|
||||
<Message Id="BadDigitForRadix" Text="'{0}' is not a valid digit for the specified radix"/>
|
||||
<Message Id="EndedWithTagsOnStack" Text="input ended before all started tags were ended; last tag started is '{0}'"/>
|
||||
<Message Id="NestedCDATA" Text="nested CDATA section illegal"/>
|
||||
<Message Id="UnknownPrefix" Text="prefix '{0}' can not be resolved to namespace URI"/>
|
||||
<Message Id="PartialTagMarkupError" Text="start and the end tags are in different entities"/>
|
||||
<Message Id="EmptyMainEntity" Text="XML document cannot be empty"/>
|
||||
<Message Id="CDATAOutsideOfContent" Text="CDATA section is illegal outside the root element"/>
|
||||
<Message Id="Unexpected2ndSurrogateChar" Text="unexpected trailing surrogate character"/>
|
||||
<Message Id="NoPIStartsWithXML" Text="processing instruction cannot start with 'xml'"/>
|
||||
<Message Id="XMLDeclMustBeFirst" Text="XML or TEXT declaration must start at line 1, column 1"/>
|
||||
<Message Id="XMLVersionRequired" Text="version declaration is required in XML declaration"/>
|
||||
<Message Id="StandaloneNotLegal" Text="standalone declaration is only legal in the main XML entity"/>
|
||||
<Message Id="EncodingRequired" Text="encoding declaration is required in TEXT declaration"/>
|
||||
<Message Id="ColonNotLegalWithNS" Text="colon is illegal in names when namespaces are enabled"/>
|
||||
<Message Id="XMLException_Fatal" Text="{0}"/>
|
||||
<Message Id="BadSchemaLocation" Text="schemaLocation does not contain namespace-location pairs"/>
|
||||
<Message Id="SchemaScanFatalError" Text="fatal error during schema scan"/>
|
||||
<Message Id="IllegalRefInStandalone" Text="reference to external entity declaration '{0}' is illegal in standalone document"/>
|
||||
<Message Id="PEBetweenDecl" Text="partial markup in parameter entity replacement text in complete declaration"/>
|
||||
<Message Id="NoEmptyStrNamespace" Text="invalid namespace value in prefix-namespace mapping '{0}'"/>
|
||||
<Message Id="NoUseOfxmlnsAsPrefix" Text="prefix 'xmlns' cannot be explicitly bound to namespace"/>
|
||||
<Message Id="NoUseOfxmlnsURI" Text="namespace for 'xmlns' cannot be explicitly bound to prefix"/>
|
||||
<Message Id="PrefixXMLNotMatchXMLURI" Text="prefix 'xml' cannot be bound to namespace other than its canonical namespace"/>
|
||||
<Message Id="XMLURINotMatchXMLPrefix" Text="namespace for 'xml' cannot be bound to prefix other than 'xml'"/>
|
||||
<Message Id="NoXMLNSAsElementPrefix" Text="element '{0}' cannot have 'xmlns' as its prefix"/>
|
||||
<Message Id="CT_SimpleTypeChildRequired" Text="restriction must contain simpleType definition"/>
|
||||
<Message Id="InvalidRootElemInDOCTYPE" Text="invalid root element '{0}' in DOCTYPE declaration"/>
|
||||
<Message Id="InvalidElementName" Text="invalid element name '{0}'"/>
|
||||
<Message Id="InvalidAttrName" Text="invalid attribute name '{0}'"/>
|
||||
<Message Id="InvalidEntityRefName" Text="invalid entity reference name '{0}'"/>
|
||||
<Message Id="DuplicateDocTypeDecl" Text="DOCTYPE declaration already seen"/>
|
||||
<Message Id="XIncludeOrphanFallback" Text="fallback element is not a direct child of include element"/>
|
||||
<Message Id="XIncludeNoHref" Text="include element without 'href' attribute"/>
|
||||
<Message Id="XIncludeXPointerNotSupported" Text="include element with XPointer specification; XPointer is not yet supported"/>
|
||||
<Message Id="XIncludeInvalidParseVal" Text="invalid 'parse' attribute value '{0}'; expected 'text' or 'xml'"/>
|
||||
<Message Id="XIncludeMultipleFallbackElems" Text="multiple fallback elements in document '{0}'"/>
|
||||
<Message Id="XIncludeIncludeFailedNoFallback" Text="include failed and no fallback element found in document '{0}'"/>
|
||||
<Message Id="XIncludeCircularInclusionLoop" Text="circular inclusion in document '{0}'"/>
|
||||
<Message Id="XIncludeCircularInclusionDocIncludesSelf" Text="self-inclusion in document '{0}'"/>
|
||||
<Message Id="XIncludeDisallowedChild" Text="element '{0}' is not allowed as a child of include element"/>
|
||||
<Message Id="XIncludeConflictingNotation" Text="included notation '{0}' conflicts with notation already defined"/>
|
||||
<Message Id="XIncludeConflictingEntity" Text="included entity '{0}' conflicts with entity already defined"/>
|
||||
</FatalError>
|
||||
</MsgDomain>
|
||||
<MsgDomain Domain="http://apache.org/xml/messages/XMLValidity">
|
||||
<Error>
|
||||
<Message Id="ElementNotDefined" Text="no declaration found for element '{0}'"/>
|
||||
<Message Id="AttNotDefined" Text="no declaration found for attribute '{0}'"/>
|
||||
<Message Id="NotationNotDeclared" Text="notation '{0}' is referenced but was never declared"/>
|
||||
<Message Id="RootElemNotLikeDocType" Text="root element differs from that declared in DOCTYPE"/>
|
||||
<Message Id="RequiredAttrNotProvided" Text="missing required attribute '{0}'"/>
|
||||
<Message Id="ElementNotValidForContent" Text="element '{0}' is not allowed for content model '{1}'"/>
|
||||
<Message Id="BadIDAttrDefType" Text="ID attribute must be #IMPLIED or #REQUIRED"/>
|
||||
<Message Id="InvalidEmptyAttValue" Text="attribute cannot have empty value"/>
|
||||
<Message Id="ElementAlreadyExists" Text="element '{0}' has already been declared"/>
|
||||
<Message Id="MultipleIdAttrs" Text="element '{0}' has more than one ID attribute"/>
|
||||
<Message Id="ReusedIDValue" Text="ID value '{0}' has already been used"/>
|
||||
<Message Id="IDNotDeclared" Text="ID attribute '{0}' is referenced but was never declared"/>
|
||||
<Message Id="UnknownNotRefAttr" Text="attribute '{0}' refers to undeclared notation '{1}'"/>
|
||||
<Message Id="UndeclaredElemInDocType" Text="element '{0}' is specified in DOCTYPE but was never declared"/>
|
||||
<Message Id="EmptyNotValidForContent" Text="empty content is not valid for content model '{0}'"/>
|
||||
<Message Id="AttNotDefinedForElement" Text="attribute '{0}' is not declared for element '{1}'"/>
|
||||
<Message Id="BadEntityRefAttr" Text="value '{0}' for attribute '{1}' of type ENTITY/ENTITIES must refer to external, unparsed entity"/>
|
||||
<Message Id="UnknownEntityRefAttr" Text="attribute '{0}' refers to unknown entity '{1}'"/>
|
||||
<Message Id="ColonNotValidWithNS" Text="attribute of type ID/IDREF/IDREFS/ENTITY/ENTITIES/NOTATION cannot contain colon when namespaces are enabled"/>
|
||||
<Message Id="NotEnoughElemsForCM" Text="missing elements in content model '{0}'"/>
|
||||
<Message Id="NoCharDataInCM" Text="no character data is allowed by content model"/>
|
||||
<Message Id="DoesNotMatchEnumList" Text="value '{0}' for attribute '{1}' does not match its type's defined enumeration or notation list"/>
|
||||
<Message Id="AttrValNotName" Text="value '{0}' for attribute '{1}' is invalid Name or NMTOKEN value"/>
|
||||
<Message Id="NoMultipleValues" Text="attribute '{0}' does not allow multiple values"/>
|
||||
<Message Id="NotSameAsFixedValue" Text="attribute '{0}' has value '{1}' that does not match its #FIXED value '{2}'"/>
|
||||
<Message Id="RepElemInMixed" Text="element types cannot be duplicated in mixed content model"/>
|
||||
<Message Id="FeatureUnsupported" Text="{0} is not supported"/>
|
||||
<Message Id="GroupContentRestricted" Text="'{0}' is not allowed in the {1} compositor; only element, group, choice, sequence, and any are allowed"/>
|
||||
<Message Id="UnknownBaseDatatype" Text="base type '{0}' not found in '{1}' definition"/>
|
||||
<Message Id="NoContentForRef" Text="{0} declaration with 'ref' attribute cannot have content"/>
|
||||
<Message Id="DatatypeError" Text="{0}"/>
|
||||
<Message Id="ProhibitedAttributePresent" Text="prohibited attribute '{0}' is present"/>
|
||||
<Message Id="IllegalXMLSpace" Text="illegal 'xml:space' declaration"/>
|
||||
<Message Id="WrongTargetNamespace" Text="schema document '{0}' has different target namespace from the one specified in instance document '{1}'"/>
|
||||
<Message Id="SimpleTypeHasChild" Text="element '{0}' is of simple type and cannot have elements in its content"/>
|
||||
<Message Id="NoDatatypeValidatorForSimpleType" Text="unable to find validator for simple type of element '{0}'"/>
|
||||
<Message Id="GrammarNotFound" Text="grammar not found for namespace '{0}'"/>
|
||||
<Message Id="DisplayErrorMessage" Text="{0}"/>
|
||||
<Message Id="NillNotAllowed" Text="'xsi:nil' specified for non-nillable element '{0}'"/>
|
||||
<Message Id="NilAttrNotEmpty" Text="element '{0}' is nil and must be empty"/>
|
||||
<Message Id="FixedDifferentFromActual" Text="content of element '{0}' differs from its declared fixed value"/>
|
||||
<Message Id="NoDatatypeValidatorForAttribute" Text="unable to find validator for simple type of attribute '{0}'"/>
|
||||
<Message Id="GenericError" Text="error during schema scan"/>
|
||||
<Message Id="ElementNotQualified" Text="element '{0}' must be qualified"/>
|
||||
<Message Id="ElementNotUnQualified" Text="element '{0}' must be unqualified"/>
|
||||
<Message Id="VC_IllegalRefInStandalone" Text="reference to external entity declaration '{0}' is not allowed in standalone document"/>
|
||||
<Message Id="NoDefAttForStandalone" Text="attribute '{0}' in element '{1}' has default value and must be specified in standalone document"/>
|
||||
<Message Id="NoAttNormForStandalone" Text="attribute '{0}' must not be changed by normalization in standalone document"/>
|
||||
<Message Id="NoWSForStandalone" Text="whitespace must not occur between externally declared elements with element content in standalone document"/>
|
||||
<Message Id="VC_EntityNotFound" Text="entity '{0}' not found"/>
|
||||
<Message Id="PartialMarkupInPE" Text="partial markup in parameter entity replacement text"/>
|
||||
<Message Id="DatatypeValidationFailure" Text="failed to validate '{0}'"/>
|
||||
<Message Id="UniqueParticleAttributionFail" Text="complex type '{0}' violates the unique particle attribution rule in its components '{1}' and '{2}'"/>
|
||||
<Message Id="NoAbstractInXsiType" Text="abstract type '{0}' cannot be used in 'xsi:type'"/>
|
||||
<Message Id="NoDirectUseAbstractElement" Text="element '{0}' is abstract; use non-abstract member of its substitution group instead"/>
|
||||
<Message Id="NoUseAbstractType" Text="type of element '{0}' is abstract; use 'xsi:type' to specify non-abstract type instead"/>
|
||||
<Message Id="BadXsiType" Text="type '{0}' specified in 'xsi:type' cannot be resolved"/>
|
||||
<Message Id="NonDerivedXsiType" Text="type '{0}' specified in 'xsi:type' does not derive from type of element '{1}'"/>
|
||||
<Message Id="ElemNoSubforBlock" Text="element '{0}' does not permit substitution"/>
|
||||
<Message Id="TypeNoSubforBlock" Text="complex type '{0}' does not permit substitution"/>
|
||||
<Message Id="AttributeNotQualified" Text="attribute '{0}' must be qualified"/>
|
||||
<Message Id="AttributeNotUnQualified" Text="attribute '{0}' must be unqualified"/>
|
||||
<Message Id="IC_FieldMultipleMatch" Text="identity constraint field matches more than one value within the scope of its selector; field must match unique value"/>
|
||||
<Message Id="IC_UnknownField" Text="unknown identity constraint field"/>
|
||||
<Message Id="IC_AbsentKeyValue" Text="element '{0}' has identity constraint key with no value"/>
|
||||
<Message Id="IC_KeyNotEnoughValues" Text="element '{0}' does not have enough values for identity constraint key '{1}'"/>
|
||||
<Message Id="IC_KeyMatchesNillable" Text="element '{0}' declares identity constraint key that matches nillable element"/>
|
||||
<Message Id="IC_DuplicateUnique" Text="element '{0}' declares duplicate identity constraint unique values"/>
|
||||
<Message Id="IC_DuplicateKey" Text="element '{0}' declares duplicate identity constraint key values"/>
|
||||
<Message Id="IC_KeyRefOutOfScope" Text="keyref '{0}' refers to out of scope key/unique"/>
|
||||
<Message Id="IC_KeyNotFound" Text="identity constraint key for element '{0}' not found"/>
|
||||
<Message Id="NonWSContent" Text="non-whitespace characters are not allowed in schema declarations other than appinfo and documentation"/>
|
||||
<Message Id="EmptyElemNotationAttr" Text="element '{0}' declared EMPTY but has attribute '{1}' of type NOTATION"/>
|
||||
<Message Id="EmptyElemHasContent" Text="element '{0}' declared EMPTY and cannot have content, not even entity references, comments, PIs, or whitespaces"/>
|
||||
<Message Id="ElemOneNotationAttr" Text="element '{0}' has more than one attribute of type NOTATION"/>
|
||||
<Message Id="AttrDupToken" Text="attribute '{0}' has non-distinct token '{1}'"/>
|
||||
<Message Id="ElemChildrenHasInvalidWS" Text="content model of element '{0}' does not allow escaped whitespaces"/>
|
||||
</Error>
|
||||
</MsgDomain>
|
||||
<MsgDomain Domain="http://apache.org/xml/messages/XML4CErrors">
|
||||
<Warning>
|
||||
<Message Id="Scan_CouldNotOpenSource_Warning" Text="unable to open primary document entity '{0}'"/>
|
||||
</Warning>
|
||||
<FatalError>
|
||||
<Message Id="Array_BadIndex" Text="index is beyond array bounds"/>
|
||||
<Message Id="Array_BadNewSize" Text="new array size is less than the old"/>
|
||||
<Message Id="AttrList_BadIndex" Text="index is beyond maximum attribute index"/>
|
||||
<Message Id="AttDef_BadAttType" Text="invalid AttType value"/>
|
||||
<Message Id="AttDef_BadDefAttType" Text="invalid DefAttType value"/>
|
||||
<Message Id="Bitset_BadIndex" Text="bit index is beyond set size"/>
|
||||
<Message Id="Bitset_NotEqualSize" Text="bit sets have different sizes"/>
|
||||
<Message Id="BufMgr_NoMoreBuffers" Text="no more buffers available"/>
|
||||
<Message Id="BufMgr_BufferNotInPool" Text="buffer is not found in the manager's pool"/>
|
||||
<Message Id="CPtr_PointerIsZero" Text="NULL pointer"/>
|
||||
<Message Id="CM_BinOpHadUnaryType" Text="binary operation node has unary node type"/>
|
||||
<Message Id="CM_MustBeMixedOrChildren" Text="content type must be mixed or children"/>
|
||||
<Message Id="CM_NoPCDATAHere" Text="PCDATA node is illegal at this point"/>
|
||||
<Message Id="CM_UnaryOpHadBinType" Text="unary operation node has binary node type"/>
|
||||
<Message Id="CM_UnknownCMType" Text="unknown content model type"/>
|
||||
<Message Id="CM_UnknownCMSpecType" Text="unknown content spec type"/>
|
||||
<Message Id="CM_NoParentCSN" Text="parent element has no content spec node"/>
|
||||
<Message Id="CM_NotValidSpecTypeForNode" Text="invalid spec type for '{0}'"/>
|
||||
<Message Id="DTD_UnknownCreateReason" Text="unknown creation reason value"/>
|
||||
<Message Id="ElemStack_EmptyStack" Text="element stack is empty"/>
|
||||
<Message Id="ElemStack_StackUnderflow" Text="pop operation requested on empty stack"/>
|
||||
<Message Id="ElemStack_NoParentPushed" Text="parent operation requested with only one element in stack"/>
|
||||
<Message Id="Enum_NoMoreElements" Text="no more elements in enumerator"/>
|
||||
<Message Id="File_CouldNotOpenFile" Text="unable to open file '{0}'"/>
|
||||
<Message Id="File_CouldNotGetCurPos" Text="unable to query file position"/>
|
||||
<Message Id="File_CouldNotCloseFile" Text="unable to close file"/>
|
||||
<Message Id="File_CouldNotSeekToEnd" Text="unable to seek to the end of file"/>
|
||||
<Message Id="File_CouldNotSeekToPos" Text="unable to seek to the required position in file"/>
|
||||
<Message Id="File_CouldNotDupHandle" Text="unable to duplicate handle"/>
|
||||
<Message Id="File_CouldNotReadFromFile" Text="unable to read data from file"/>
|
||||
<Message Id="File_CouldNotWriteToFile" Text="unable to write data to file"/>
|
||||
<Message Id="File_CouldNotResetFile" Text="unable to reset file position to the beginning"/>
|
||||
<Message Id="File_CouldNotGetSize" Text="unable to get file size"/>
|
||||
<Message Id="File_CouldNotGetBasePathName" Text="unable to determine file base pathname"/>
|
||||
<Message Id="Gen_ParseInProgress" Text="parsing in progress"/>
|
||||
<Message Id="Gen_NoDTDValidator" Text="DOCTYPE declaration was seen but installed validator does not support DTD"/>
|
||||
<Message Id="Gen_CouldNotOpenDTD" Text="unable to open DTD document '{0}'"/>
|
||||
<Message Id="Gen_CouldNotOpenExtEntity" Text="unable to open external entity '{0}'"/>
|
||||
<Message Id="Gen_UnexpectedEOF" Text="unexpected end of input"/>
|
||||
<Message Id="HshTbl_ZeroModulus" Text="zero hash modulus"/>
|
||||
<Message Id="HshTbl_BadHashFromKey" Text="hashing key produced invalid hash"/>
|
||||
<Message Id="HshTbl_NoSuchKeyExists" Text="no such key in hash table"/>
|
||||
<Message Id="Mutex_CouldNotDestroy" Text="unable to destroy mutex"/>
|
||||
<Message Id="NetAcc_InternalError" Text="internal error in NetAccessor"/>
|
||||
<Message Id="NetAcc_LengthError" Text="NetAccessor is unable to determine length of remote file"/>
|
||||
<Message Id="NetAcc_InitFailed" Text="unable to initialize NetAccessor"/>
|
||||
<Message Id="NetAcc_TargetResolution" Text="unable to resolve host/address '{0}'"/>
|
||||
<Message Id="NetAcc_CreateSocket" Text="unable to create socket for URL '{0}'"/>
|
||||
<Message Id="NetAcc_ConnSocket" Text="unable to connect socket for URL '{0}'"/>
|
||||
<Message Id="NetAcc_WriteSocket" Text="unable to write to socket for URL '{0}'"/>
|
||||
<Message Id="NetAcc_ReadSocket" Text="unable to read from socket for URL '{0}'"/>
|
||||
<Message Id="NetAcc_UnsupportedMethod" Text="specified HTTP method is not supported by NetAccessor"/>
|
||||
<Message Id="Pool_ElemAlreadyExists" Text="element '{0}' is already in pool"/>
|
||||
<Message Id="Pool_InvalidId" Text="invalid pool element id"/>
|
||||
<Message Id="Pool_ZeroModulus" Text="zero hash modulus"/>
|
||||
<Message Id="RdrMgr_ReaderIdNotFound" Text="reader id not found"/>
|
||||
<Message Id="Reader_BadAutoEncoding" Text="invalid auto encoding value"/>
|
||||
<Message Id="Reader_CouldNotDecodeFirstLine" Text="unable to decode first line in entity '{0}'"/>
|
||||
<Message Id="Reader_NelLsepinDecl" Text="XML or TEXT declaration '{0}' cannot have NEL or lsep"/>
|
||||
<Message Id="Reader_SrcOfsNotSupported" Text="current transcoding service does not support source offset information"/>
|
||||
<Message Id="Reader_EncodingStrRequired" Text="EBCDIC file must provide encoding declaration"/>
|
||||
<Message Id="Scan_CouldNotOpenSource" Text="unable to open primary document entity '{0}'"/>
|
||||
<Message Id="Scan_UnbalancedStartEnd" Text="unbalanced start/end tags"/>
|
||||
<Message Id="Scan_BadPScanToken" Text="call to scanNext is illegal at this point"/>
|
||||
<Message Id="Stack_BadIndex" Text="index is past top of stack"/>
|
||||
<Message Id="Stack_EmptyStack" Text="empty stack"/>
|
||||
<Message Id="Str_ZeroSizedTargetBuf" Text="target buffer cannot have zero max size"/>
|
||||
<Message Id="Str_UnknownRadix" Text="unsupported radix; expected 2, 8, 10, or 16"/>
|
||||
<Message Id="Str_TargetBufTooSmall" Text="target buffer is too small"/>
|
||||
<Message Id="Str_StartIndexPastEnd" Text="start index is past the end of string"/>
|
||||
<Message Id="Str_ConvertOverflow" Text="string representation overflows output binary result"/>
|
||||
<Message Id="StrPool_IllegalId" Text="illegal string pool id"/>
|
||||
<Message Id="Trans_Unrepresentable" Text="char 0x{0} is not representable in '{1}' encoding"/>
|
||||
<Message Id="Trans_BadSrcSeq" Text="invalid multi-byte sequence"/>
|
||||
<Message Id="Trans_BadSrcCP" Text="code point 0x{0} is invalid for '{1}' encoding"/>
|
||||
<Message Id="Trans_BadTrailingSurrogate" Text="leading surrogate followed by invalid trailing surrogate"/>
|
||||
<Message Id="Trans_CantCreateCvtrFor" Text="unable to create converter for '{0}' encoding"/>
|
||||
<Message Id="URL_MalformedURL" Text="malformed URL"/>
|
||||
<Message Id="URL_UnsupportedProto" Text="unsupported protocol in URL"/>
|
||||
<Message Id="URL_UnsupportedProto1" Text="URL protocol '{0}' is unsupported"/>
|
||||
<Message Id="URL_NoProtocolPresent" Text="missing protocol prefix"/>
|
||||
<Message Id="URL_ExpectingTwoSlashes" Text="expected '//' after protocol"/>
|
||||
<Message Id="URL_RelativeBaseURL" Text="base part of URL cannot be relative"/>
|
||||
<Message Id="URL_BadPortField" Text="port field must be 16-bit decimal number"/>
|
||||
<Message Id="UTF8_FormatError" Text="invalid byte '{1}' at position {0} of a {2}-byte sequence"/>
|
||||
<Message Id="UTF8_Invalid_3BytesSeq" Text="invalid bytes '{0}' and '{1}' of a 3-byte sequence"/>
|
||||
<Message Id="UTF8_Irregular_3BytesSeq" Text="irregular bytes '{0}' and '{1}' of a 3-byte sequence"/>
|
||||
<Message Id="UTF8_Invalid_4BytesSeq" Text="invalid bytes '{0}' and '{1}' of a 4-byte sequence"/>
|
||||
<Message Id="UTF8_Exceeds_BytesLimit" Text="exceeded byte limit at byte '{0}' in a {1}-byte sequence"/>
|
||||
<Message Id="Vector_BadIndex" Text="index is beyond vector bounds"/>
|
||||
<Message Id="Val_InvalidElemId" Text="invalid element id"/>
|
||||
<Message Id="Val_CantHaveIntSS" Text="internal subset is not allowed when reusing the grammar"/>
|
||||
<Message Id="XMLRec_UnknownEncoding" Text="unknown recognizer encoding"/>
|
||||
<Message Id="Parser_Parse1" Text="illegal character at offset {0} in regular expression '{1}'"/>
|
||||
<Message Id="Parser_Parse2" Text="invalid reference number"/>
|
||||
<Message Id="Parser_Next1" Text="character expected after backslash"/>
|
||||
<Message Id="Parser_Next2" Text="unexpected '?'; '(?:', '(?=', '(?!', '(?<', '(?#', or '(?>' expected"/>
|
||||
<Message Id="Parser_Next3" Text="'(?<=' or '(?<!' expected"/>
|
||||
<Message Id="Parser_Next4" Text="unterminated comment"/>
|
||||
<Message Id="Parser_Factor1" Text="')' expected"/>
|
||||
<Message Id="Parser_Factor2" Text="unexpected end of pattern in modifier group"/>
|
||||
<Message Id="Parser_Factor3" Text="':' expected"/>
|
||||
<Message Id="Parser_Factor4" Text="unexpected end of pattern in conditional group"/>
|
||||
<Message Id="Parser_Factor5" Text="back reference, anchor, lookahead, or lookbehind expected in conditional pattern"/>
|
||||
<Message Id="Parser_Factor6" Text="more than three choices in conditional group"/>
|
||||
<Message Id="Parser_Atom1" Text="character in the U+0040-U+005f range must follow '\c'"/>
|
||||
<Message Id="Parser_Atom2" Text="'{' expected before category character"/>
|
||||
<Message Id="Parser_Atom3" Text="property name must be closed with '}'"/>
|
||||
<Message Id="Parser_Atom4" Text="unexpected meta character"/>
|
||||
<Message Id="Parser_Atom5" Text="unknown property"/>
|
||||
<Message Id="Parser_CC1" Text="POSIX character class must be closed with ':]'"/>
|
||||
<Message Id="Parser_CC2" Text="unexpected end of pattern in character class"/>
|
||||
<Message Id="Parser_CC3" Text="unknown name for POSIX character class"/>
|
||||
<Message Id="Parser_CC5" Text="']' expected"/>
|
||||
<Message Id="Parser_CC6" Text="'{0}' is invalid character range; use '\{1}' instead"/>
|
||||
<Message Id="Parser_Ope1" Text="'[' expected"/>
|
||||
<Message Id="Parser_Ope2" Text="')', '-[', '+[', or '&[' expected"/>
|
||||
<Message Id="Parser_Ope3" Text="range end code point '{0}' is less than start code point '{1}'"/>
|
||||
<Message Id="Parser_Descape1" Text="invalid Unicode hex notation"/>
|
||||
<Message Id="Parser_Descape3" Text="'\ x{' must be closed with '}'"/>
|
||||
<Message Id="Parser_Descape4" Text="invalid Unicode code point"/>
|
||||
<Message Id="Parser_Descape5" Text="anchor cannot be present at this point"/>
|
||||
<Message Id="Parser_Process2" Text="'{0}' is invalid character escape sequence"/>
|
||||
<Message Id="Parser_Quantifier1" Text="invalid quantifier in '{0}'; digit expected"/>
|
||||
<Message Id="Parser_Quantifier2" Text="invalid quantifier in '{0}'; invalid quantity or missing '}'"/>
|
||||
<Message Id="Parser_Quantifier3" Text="invalid quantifier in '{0}'; digit or '}' expected"/>
|
||||
<Message Id="Parser_Quantifier4" Text="invalid quantifier in '{0}'; min quantity must be less than or equal max quantity"/>
|
||||
<Message Id="Parser_Quantifier5" Text="invalid quantifier in '{0}'; quantity value overflow"/>
|
||||
<Message Id="Gen_NoSchemaValidator" Text="XML Schema was seen but installed validator does not support XML Schema"/>
|
||||
<Message Id="SubGrpComparator_NGR" Text="SubstitutionGroupComparator has no grammar resolver"/>
|
||||
<Message Id="FACET_Invalid_Len" Text="invalid length value '{0}'"/>
|
||||
<Message Id="FACET_Invalid_maxLen" Text="invalid maxLength value '{0}'"/>
|
||||
<Message Id="FACET_Invalid_minLen" Text="invalid minLength value '{0}'"/>
|
||||
<Message Id="FACET_NonNeg_Len" Text="length value '{0}' must be a non-negative integer"/>
|
||||
<Message Id="FACET_NonNeg_maxLen" Text="maxLength value '{0}' must be a non-negative integer"/>
|
||||
<Message Id="FACET_NonNeg_minLen" Text="minLength value '{0}' must be a non-negative integer"/>
|
||||
<Message Id="FACET_Len_maxLen" Text="both length and maxLength cannot be present at the same time"/>
|
||||
<Message Id="FACET_Len_minLen" Text="both length and minLength cannot be present at the same time"/>
|
||||
<Message Id="FACET_maxLen_minLen" Text="maxLength value '{0}' must be greater than minLength value '{1}'"/>
|
||||
<Message Id="FACET_Invalid_Tag" Text="invalid facet tag '{0}'"/>
|
||||
<Message Id="FACET_Len_baseLen" Text="length value '{0}' must be equal to length value '{1}' in the base"/>
|
||||
<Message Id="FACET_minLen_baseminLen" Text="minLength value '{0}' must be greater than or equal to minLength value '{1}' in the base"/>
|
||||
<Message Id="FACET_minLen_basemaxLen" Text="minLength value '{0}' must be less than or equal to maxLength value '{1}' in the base"/>
|
||||
<Message Id="FACET_maxLen_basemaxLen" Text="maxLength value '{0}' must be less than or equal to maxLength value '{1}' in the base"/>
|
||||
<Message Id="FACET_maxLen_baseminLen" Text="maxLength value '{0}' must be greater than or equal to minLength value '{1}' in the base"/>
|
||||
<Message Id="FACET_Len_baseMinLen" Text="length value '{0}' must be greater than or equal to minLength value '{1}' in the base"/>
|
||||
<Message Id="FACET_Len_baseMaxLen" Text="length value '{0}' must be less than or equal to maxLength value '{1}' in the base"/>
|
||||
<Message Id="FACET_minLen_baseLen" Text="minLength value '{0}' must be less than or equal to length value '{1}' in the base"/>
|
||||
<Message Id="FACET_maxLen_baseLen" Text="maxLength value '{0}' must be greater than or equal to length value '{1}' in the base"/>
|
||||
<Message Id="FACET_enum_base" Text="enumeration value '{0}' must be from the value space of the base"/>
|
||||
<Message Id="FACET_Invalid_WS" Text="whiteSpace value '{0}' must be one of 'preserve', 'replace', or 'collapse'"/>
|
||||
<Message Id="FACET_WS_collapse" Text="whiteSpace value is 'preserve' or 'replace' while base type whiteSpace value is 'collapse'"/>
|
||||
<Message Id="FACET_WS_replace" Text="whiteSpace value is 'preserve' while base type whiteSpace value is 'replace'"/>
|
||||
<Message Id="FACET_Invalid_MaxIncl" Text="invalid maxInclusive value '{0}'"/>
|
||||
<Message Id="FACET_Invalid_MaxExcl" Text="invalid maxExclusive value '{0}'"/>
|
||||
<Message Id="FACET_Invalid_MinIncl" Text="invalid minInclusive value '{0}'"/>
|
||||
<Message Id="FACET_Invalid_MinExcl" Text="invalid minExclusive value '{0}'"/>
|
||||
<Message Id="FACET_Invalid_TotalDigit" Text="invalid totalDigits value '{0}'"/>
|
||||
<Message Id="FACET_Invalid_FractDigit" Text="invalid fractionDigits value '{0}'"/>
|
||||
<Message Id="FACET_PosInt_TotalDigit" Text="totalDigits value '{0}' must be a positive integer"/>
|
||||
<Message Id="FACET_NonNeg_FractDigit" Text="fractionDigits value '{0}' must be a non-negative integer"/>
|
||||
<Message Id="FACET_max_Incl_Excl" Text="both maxInclusive and maxExclusive cannot be present at the same time"/>
|
||||
<Message Id="FACET_min_Incl_Excl" Text="both minInclusive and minExclusive cannot be present at the same time"/>
|
||||
<Message Id="FACET_maxExcl_minExcl" Text="maxExclusive value '{0}' must be greater than minExclusive value '{1}'"/>
|
||||
<Message Id="FACET_maxExcl_minIncl" Text="maxExclusive value '{0}' must be greater than minInclusive value '{1}'"/>
|
||||
<Message Id="FACET_maxIncl_minExcl" Text="maxInclusive value '{0}' must be greater than minExclusive value '{1}'"/>
|
||||
<Message Id="FACET_maxIncl_minIncl" Text="maxInclusive value '{0}' must be greater than minInclusive value '{1}'"/>
|
||||
<Message Id="FACET_TotDigit_FractDigit" Text="totalDigits value '{0}' must be greater than fractionDigits value '{1}'"/>
|
||||
<Message Id="FACET_maxIncl_base_maxExcl" Text="maxInclusive value '{0}' must be less than maxExclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_maxIncl_base_maxIncl" Text="maxInclusive value '{0}' must be less than or equal to maxInclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_maxIncl_base_minIncl" Text="maxInclusive value '{0}' must be greater than or equal to minInclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_maxIncl_base_minExcl" Text="maxInclusive value '{0}' must be greater than minExclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_maxExcl_base_maxExcl" Text="maxExclusive value '{0}' must be less than or equal to maxExclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_maxExcl_base_maxIncl" Text="maxExclusive value '{0}' must be less than or equal to maxInclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_maxExcl_base_minIncl" Text="maxExclusive value '{0}' must be greater than minInclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_maxExcl_base_minExcl" Text="maxExclusive value '{0}' must be greater than minExclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_minExcl_base_maxExcl" Text="minExclusive value '{0}' must be less than maxExclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_minExcl_base_maxIncl" Text="minExclusive value '{0}' must be less than or equal to maxInclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_minExcl_base_minIncl" Text="minExclusive value '{0}' must be greater than minInclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_minExcl_base_minExcl" Text="minExclusive value '{0}' must be greater than minExclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_minIncl_base_maxExcl" Text="minInclusive value '{0}' must be less than maxExclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_minIncl_base_maxIncl" Text="minInclusive value '{0}' must be less than or equal to maxInclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_minIncl_base_minIncl" Text="minInclusive value '{0}' must be greater than or equal to minInclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_minIncl_base_minExcl" Text="minInclusive value '{0}' must be greater than minExclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_maxIncl_notFromBase" Text="maxInclusive value '{0}' must be from the base type value space"/>
|
||||
<Message Id="FACET_maxExcl_notFromBase" Text="maxExclusive value '{0}' must be from the base type value space"/>
|
||||
<Message Id="FACET_minIncl_notFromBase" Text="minInclusive value '{0}' must be from the base type value space"/>
|
||||
<Message Id="FACET_minExcl_notFromBase" Text="minExclusive value '{0}' must be from the base type value space"/>
|
||||
<Message Id="FACET_totalDigit_base_totalDigit" Text="totalDigits value '{0}' must be less than or equal to totalDigits value '{1}' in the base"/>
|
||||
<Message Id="FACET_fractDigit_base_totalDigit" Text="fractionDigits value '{0}' must be less than or equal to totalDigits value '{1}' in the base"/>
|
||||
<Message Id="FACET_fractDigit_base_fractDigit" Text="fractionDigits value '{0}' must be less than or equal to fractionDigits value '{1}' in the base"/>
|
||||
<Message Id="FACET_maxIncl_base_fixed" Text="maxInclusive value '{0}' must be equal to fixed maxInclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_maxExcl_base_fixed" Text="maxExclusive value '{0}' must be equal to fixed maxExclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_minIncl_base_fixed" Text="minInclusive value '{0}' must be equal to fixed minInclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_minExcl_base_fixed" Text="minExclusive value '{0}' must be equal to fixed minExclusive value '{1}' in the base"/>
|
||||
<Message Id="FACET_totalDigit_base_fixed" Text="totalDigits value '{0}' must be equal to fixed totalDigits value '{1}' in the base"/>
|
||||
<Message Id="FACET_fractDigit_base_fixed" Text="fractionDigits value '{0}' must be equal to fixed fractionDigits value '{1}' in the base"/>
|
||||
<Message Id="FACET_maxLen_base_fixed" Text="maxLength value '{0}' must be equal to fixed maxLength value '{1}' in the base"/>
|
||||
<Message Id="FACET_minLen_base_fixed" Text="minLength value '{0}' must be equal to fixed minLength value '{1}' in the base"/>
|
||||
<Message Id="FACET_whitespace_base_fixed" Text="whiteSpace value '{0}' must be equal to fixed whiteSpace value '{1}' in the base"/>
|
||||
<Message Id="FACET_internalError_fixed" Text="internal error while processing fixed facet"/>
|
||||
<Message Id="FACET_List_Null_baseValidator" Text="list itemType is empty"/>
|
||||
<Message Id="FACET_Union_Null_memberTypeValidators" Text="union memberTypes is empty"/>
|
||||
<Message Id="FACET_Union_Null_baseValidator" Text="restriction union base is empty"/>
|
||||
<Message Id="FACET_Union_invalid_baseValidatorType" Text="restriction union base is '{0}' instead of union"/>
|
||||
<Message Id="VALUE_NotMatch_Pattern" Text="value '{0}' does not match regular expression facet '{1}'"/>
|
||||
<Message Id="VALUE_Not_Base64" Text="value '{0}' is invalid Base64-encoded binary"/>
|
||||
<Message Id="VALUE_Not_HexBin" Text="value '{0}' is invalid Hex-encoded binary"/>
|
||||
<Message Id="VALUE_GT_maxLen" Text="value '{0}' has length '{1}' which exceeds maxLength facet value '{2}'"/>
|
||||
<Message Id="VALUE_LT_minLen" Text="value '{0}' has length '{1}' which is less than minLength facet value '{2}'"/>
|
||||
<Message Id="VALUE_NE_Len" Text="value '{0}' has length '{1}' which is not equal to length facet value '{2}'"/>
|
||||
<Message Id="VALUE_NotIn_Enumeration" Text="value '{0}' not in enumeration"/>
|
||||
<Message Id="VALUE_exceed_totalDigit" Text="value '{0}' has '{1}' total digits which exceeds totalDigits facet value '{2}'"/>
|
||||
<Message Id="VALUE_exceed_fractDigit" Text="value '{0}' has '{1}' fraction digits which exceeds fractionDigits facet value '{2}'"/>
|
||||
<Message Id="VALUE_exceed_maxIncl" Text="value '{0}' must be less than or equal to maxInclusive facet value '{1}'"/>
|
||||
<Message Id="VALUE_exceed_maxExcl" Text="value '{0}' must be less than maxExclusive facet value '{1}'"/>
|
||||
<Message Id="VALUE_exceed_minIncl" Text="value '{0}' must be greater than or equal to minInclusive facet value '{1}'"/>
|
||||
<Message Id="VALUE_exceed_minExcl" Text="value '{0}' must be greater than or equal to minExclusive facet value '{1}'"/>
|
||||
<Message Id="VALUE_WS_replaced" Text="value '{0}' is not whitespace replaced"/>
|
||||
<Message Id="VALUE_WS_collapsed" Text="value '{0}' is not whitespace collapsed"/>
|
||||
<Message Id="VALUE_Invalid_NCName" Text="value '{0}' is invalid NCName"/>
|
||||
<Message Id="VALUE_Invalid_Name" Text="value '{0}' is invalid {1}"/>
|
||||
<Message Id="VALUE_ID_Not_Unique" Text="ID value '{0}' is not unique"/>
|
||||
<Message Id="VALUE_ENTITY_Invalid" Text="value '{0}' is invalid ENTITY"/>
|
||||
<Message Id="VALUE_QName_Invalid" Text="value '{0}' is invalid QName"/>
|
||||
<Message Id="VALUE_NOTATION_Invalid" Text="NOTATION '{0}' must be valid QName"/>
|
||||
<Message Id="VALUE_no_match_memberType" Text="value '{0}' does not match any member types of the union"/>
|
||||
<Message Id="VALUE_URI_Malformed" Text="value '{0}' is invalid anyURI"/>
|
||||
<Message Id="XMLNUM_emptyString" Text="empty string encountered"/>
|
||||
<Message Id="XMLNUM_WSString" Text="string contains only whitespaces"/>
|
||||
<Message Id="XMLNUM_2ManyDecPoint" Text="more than one decimal point encountered"/>
|
||||
<Message Id="XMLNUM_Inv_chars" Text="invalid character encountered"/>
|
||||
<Message Id="XMLNUM_null_ptr" Text="NULL pointer encountered"/>
|
||||
<Message Id="XMLNUM_URI_Component_Empty" Text="unable to construct URI with NULL/empty {0}"/>
|
||||
<Message Id="XMLNUM_URI_Component_for_GenURI_Only" Text="{0} '{1}' can only be set for a generic URI"/>
|
||||
<Message Id="XMLNUM_URI_Component_Invalid_EscapeSequence" Text="{0} contains invalid escape sequence '{1}'"/>
|
||||
<Message Id="XMLNUM_URI_Component_Invalid_Char" Text="{0} contains invalid character '{1}'"/>
|
||||
<Message Id="XMLNUM_URI_Component_Set_Null" Text="{0} cannot be NULL"/>
|
||||
<Message Id="XMLNUM_URI_Component_Not_Conformant" Text="'{1}' is not conformant to {0}"/>
|
||||
<Message Id="XMLNUM_URI_No_Scheme" Text="no scheme found in URI"/>
|
||||
<Message Id="XMLNUM_URI_NullHost" Text="{0} '{1}' may not be specified if host is not specified"/>
|
||||
<Message Id="XMLNUM_URI_NullPath" Text="{0} '{1}' may not be specified if path is not specified"/>
|
||||
<Message Id="XMLNUM_URI_PortNo_Invalid" Text="port number '{0}' must be in the (0,65535) range"/>
|
||||
<Message Id="XMLNUM_DBL_FLT_InvalidType" Text="internal error while validating '{0}'"/>
|
||||
<Message Id="Regex_Result_Not_Set" Text="result not set"/>
|
||||
<Message Id="Regex_CompactRangesError" Text="internal error in CompactRanges"/>
|
||||
<Message Id="Regex_MergeRangesTypeMismatch" Text="mismatched type in MergeRanges"/>
|
||||
<Message Id="Regex_SubtractRangesError" Text="internal error in SubtractRanges"/>
|
||||
<Message Id="Regex_IntersectRangesError" Text="internal error in IntersectRanges"/>
|
||||
<Message Id="Regex_ComplementRangesInvalidArg" Text="argument must be RangeToken"/>
|
||||
<Message Id="Regex_InvalidCategoryName" Text="invalid category name '{0}'"/>
|
||||
<Message Id="Regex_KeywordNotFound" Text="keyword '{0}' not found"/>
|
||||
<Message Id="Regex_BadRefNo" Text="reference number must be greater than zero"/>
|
||||
<Message Id="Regex_UnknownOption" Text="option '{0}' unknown"/>
|
||||
<Message Id="Regex_UnknownTokenType" Text="unknown token type"/>
|
||||
<Message Id="Regex_RangeTokenGetError" Text="unable to get RangeToken for '{0}'"/>
|
||||
<Message Id="Regex_NotSupported" Text="not supported"/>
|
||||
<Message Id="Regex_InvalidChildIndex" Text="invalid child index"/>
|
||||
<Message Id="Regex_RepPatMatchesZeroString" Text="replace pattern cannot match zero-length string"/>
|
||||
<Message Id="Regex_InvalidRepPattern" Text="invalid replace pattern"/>
|
||||
<Message Id="NEL_RepeatedCalls" Text="enabling NEL option can only be done once per process"/>
|
||||
<Message Id="Out_Of_Memory" Text="out of memory"/>
|
||||
<Message Id="DV_InvalidOperation" Text="operation is not allowed"/>
|
||||
<Message Id="XPath_NoAttrSelector" Text="selector cannot select attribute"/>
|
||||
<Message Id="XPath_NoUnionAtStart" Text="'|' at the beginning of XPath expression is illegal"/>
|
||||
<Message Id="XPath_NoMultipleUnion" Text="'||' in XPath expression is illegal"/>
|
||||
<Message Id="XPath_MissingAttr" Text="missing attribute name in XPath expression"/>
|
||||
<Message Id="XPath_ExpectedToken1" Text="unexpected XPath token; expected qname, any, or namespace test"/>
|
||||
<Message Id="XPath_PrefixNoURI" Text="prefix '{0}' used in XPath expression can not be resolved to namespace URI"/>
|
||||
<Message Id="XPath_NoDoubleColon" Text="'::' in XPath expression is illegal"/>
|
||||
<Message Id="XPath_ExpectedStep1" Text="expected step following 'child' token in XPath expression"/>
|
||||
<Message Id="XPath_ExpectedStep2" Text="expected step following '//' in XPath expression"/>
|
||||
<Message Id="XPath_ExpectedStep3" Text="expected step following '/' in XPath expression"/>
|
||||
<Message Id="XPath_NoForwardSlash" Text="'/' not allowed after '//' in XPath expression"/>
|
||||
<Message Id="XPath_NoDoubleForwardSlash" Text="'//' only allowed after '.' at the beginning of XPath expression"/>
|
||||
<Message Id="XPath_NoForwardSlashAtStart" Text="'/' at the beginning of XPath expression is illegal"/>
|
||||
<Message Id="XPath_NoSelectionOfRoot" Text="root element selection is illegal in XPath expression"/>
|
||||
<Message Id="XPath_EmptyExpr" Text="empty XPath expression"/>
|
||||
<Message Id="XPath_NoUnionAtEnd" Text="XPath expression cannot end with '|'"/>
|
||||
<Message Id="XPath_InvalidChar" Text="invalid character '{0}' in XPath expression"/>
|
||||
<Message Id="XPath_TokenNotSupported" Text="unsupported XPath token"/>
|
||||
<Message Id="XPath_FindSolution" Text="fractional values not supported in XPath expression"/>
|
||||
<Message Id="DateTime_dt_invalid" Text="invalid dateTime value '{0}'"/>
|
||||
<Message Id="DateTime_dt_missingT" Text="missing 'T' separator in dateTime value '{0}'"/>
|
||||
<Message Id="DateTime_gDay_invalid" Text="invalid gDay value '{0}'"/>
|
||||
<Message Id="DateTime_gMth_invalid" Text="invalid gMonth value '{0}'"/>
|
||||
<Message Id="DateTime_gMthDay_invalid" Text="invalid gMonthDay value '{0}'"/>
|
||||
<Message Id="DateTime_dur_invalid" Text="invalid duration value '{0}'"/>
|
||||
<Message Id="DateTime_dur_Start_dashP" Text="duration value '{0}' must start with '-' or 'P'"/>
|
||||
<Message Id="DateTime_dur_noP" Text="duration value '{0}' must contain 'P'"/>
|
||||
<Message Id="DateTime_dur_DashNotFirst" Text="duration value '{0}' can contain '-' only as the first character"/>
|
||||
<Message Id="DateTime_dur_inv_b4T" Text="duration value '{0}' contains invalid text before 'T'"/>
|
||||
<Message Id="DateTime_dur_NoTimeAfterT" Text="duration value '{0}' has no time component after 'T'"/>
|
||||
<Message Id="DateTime_dur_NoElementAtAll" Text="duration value '{0}' must have at least one component"/>
|
||||
<Message Id="DateTime_dur_inv_seconds" Text="duration value '{0}' must have at least one digit after '.'"/>
|
||||
<Message Id="DateTime_date_incomplete" Text="incomplete date value '{0}'"/>
|
||||
<Message Id="DateTime_date_invalid" Text="invalid date value '{0}'"/>
|
||||
<Message Id="DateTime_time_incomplete" Text="incomplete time value '{0}'"/>
|
||||
<Message Id="DateTime_time_invalid" Text="invalid time value '{0}'"/>
|
||||
<Message Id="DateTime_ms_noDigit" Text="expected fractional seconds after '.' in time value '{0}'"/>
|
||||
<Message Id="DateTime_ym_incomplete" Text="incomplete gYearMonth value '{0}'"/>
|
||||
<Message Id="DateTime_ym_invalid" Text="invalid gYearMonth value '{0}'"/>
|
||||
<Message Id="DateTime_year_invalid" Text="invalid gYear value '{0}'"/>
|
||||
<Message Id="DateTime_year_tooShort" Text="year value '{0}' must follow 'CCYY' format"/>
|
||||
<Message Id="DateTime_year_leadingZero" Text="invalid leading zero in gYear value '{0}'"/>
|
||||
<Message Id="DateTime_ym_noMonth" Text="month component missing in gYearMonth value '{0}'"/>
|
||||
<Message Id="DateTime_tz_noUTCsign" Text="time zone expected in '{0}'"/>
|
||||
<Message Id="DateTime_tz_stuffAfterZ" Text="unexpected text after 'Z' in time zone value '{0}'"/>
|
||||
<Message Id="DateTime_tz_invalid" Text="invalid time zone value '{0}'"/>
|
||||
<Message Id="DateTime_year_zero" Text="illegal year value '{0}'"/>
|
||||
<Message Id="DateTime_mth_invalid" Text="month value '{0}' must be between 1 and 12"/>
|
||||
<Message Id="DateTime_day_invalid" Text="day value '{0}' must be between 1 and {1}"/>
|
||||
<Message Id="DateTime_hour_invalid" Text="hours value '{0}' must be between 0 and 23"/>
|
||||
<Message Id="DateTime_min_invalid" Text="minutes value '{0}' must be between 0 and 59"/>
|
||||
<Message Id="DateTime_second_invalid" Text="seconds value '{0}' must be between 0 and 60"/>
|
||||
<Message Id="DateTime_tz_hh_invalid" Text="minutes value '{0}' must be between 0 and 59"/>
|
||||
<Message Id="PD_EmptyBase" Text="derived by restriction complex type has content while base type is empty"/>
|
||||
<Message Id="PD_NSCompat1" Text="namespace of element '{0}' is not allowed by wildcard in the base"/>
|
||||
<Message Id="PD_OccurRangeE" Text="occurrence range of element '{0}' is not a valid restriction of base element's range"/>
|
||||
<Message Id="PD_NameTypeOK1" Text="element name/namespace in restriction does not match that of corresponding element in the base"/>
|
||||
<Message Id="PD_NameTypeOK2" Text="element '{0}' is nillable in the restriction while it is non-nillable in the base"/>
|
||||
<Message Id="PD_NameTypeOK3" Text="element '{0}' is either not fixed or is fixed to a different value compared to corresponding element in the base"/>
|
||||
<Message Id="PD_NameTypeOK4" Text="disallowed substitutions for element '{0}' are not a superset of those for corresponding element in the base"/>
|
||||
<Message Id="PD_NameTypeOK5" Text="element '{0}' has type that does not derive from type of corresponding element in the base"/>
|
||||
<Message Id="PD_NameTypeOK6" Text="element '{0}' has fewer identity constraints compared to corresponding element '{1}' in the base"/>
|
||||
<Message Id="PD_NameTypeOK7" Text="element '{0}' has identity constraint that does not appear in corresponding element '{1}' in the base"/>
|
||||
<Message Id="PD_Recurse1" Text="occurrence range of group is not a valid restriction of occurrence range of base group"/>
|
||||
<Message Id="PD_Recurse2" Text="no complete functional mapping between particles"/>
|
||||
<Message Id="PD_ForbiddenRes1" Text="forbidden restriction of any particle"/>
|
||||
<Message Id="PD_ForbiddenRes2" Text="forbidden restriction of all compositor"/>
|
||||
<Message Id="PD_ForbiddenRes3" Text="forbidden restriction of choice compositor"/>
|
||||
<Message Id="PD_ForbiddenRes4" Text="forbidden restriction of sequence compositor"/>
|
||||
<Message Id="PD_NSSubset1" Text="occurrence range of wildcard is not a valid restriction of base wildcard's range"/>
|
||||
<Message Id="PD_NSSubset2" Text="wildcard is not a subset of corresponding wildcard in the base"/>
|
||||
<Message Id="PD_NSRecurseCheckCardinality1" Text="occurrence range of group is not a restriction of base wildcard's range"/>
|
||||
<Message Id="PD_RecurseUnordered" Text="no complete functional mapping between particles"/>
|
||||
<Message Id="PD_MapAndSum" Text="no complete functional mapping between particles"/>
|
||||
<Message Id="PD_InvalidContentType" Text="invalid content spec node type"/>
|
||||
<Message Id="NodeIDMap_GrowErr" Text="NodeIDMap exceeds largest available size"/>
|
||||
<Message Id="XSer_ProtoType_Null_ClassName" Text="ProtoType has NULL class name"/>
|
||||
<Message Id="XSer_ProtoType_NameLen_Dif" Text="ProtoType name length '{0}' differs from expected '{1}'"/>
|
||||
<Message Id="XSer_ProtoType_Name_Dif" Text="ProtoType name '{0}' differs from expected '{1}'"/>
|
||||
<Message Id="XSer_InStream_Read_LT_Req" Text="InputStream read '{0}' is less than required '{1}'"/>
|
||||
<Message Id="XSer_InStream_Read_OverFlow" Text="InputStream read '{0}' is beyond available buffer size '{1}'"/>
|
||||
<Message Id="XSer_Storing_Violation" Text="storing violation"/>
|
||||
<Message Id="XSer_StoreBuffer_Violation" Text="store buffer violation '{0}', '{1}'"/>
|
||||
<Message Id="XSer_LoadPool_UppBnd_Exceed" Text="object tag '{0}' exceeds load pool upper boundary '{1}'"/>
|
||||
<Message Id="XSer_LoadPool_NoTally_ObjCnt" Text="load pool size '{0}' does not tally with object count '{1}'"/>
|
||||
<Message Id="XSer_Loading_Violation" Text="loading violation"/>
|
||||
<Message Id="XSer_LoadBuffer_Violation" Text="load buffer violation '{0}', '{1}'"/>
|
||||
<Message Id="XSer_Inv_ClassIndex" Text="invalid class index '{0}', '{1}'"/>
|
||||
<Message Id="XSer_Inv_checkFillBuffer_Size" Text="invalid checkFillBuffer size '{0}'"/>
|
||||
<Message Id="XSer_Inv_checkFlushBuffer_Size" Text="invalid checkFlushBuffer size '{0}'"/>
|
||||
<Message Id="XSer_Inv_Null_Pointer" Text="invalid NULL pointer encountered '{0}'"/>
|
||||
<Message Id="XSer_CreateObject_Fail" Text="createObject fails"/>
|
||||
<Message Id="XSer_ObjCount_UppBnd_Exceed" Text="object count '{0}' exceeds upper boundary '{1}'"/>
|
||||
<Message Id="XSer_GrammarPool_Empty" Text="grammar pool is empty"/>
|
||||
<Message Id="XSer_GrammarPool_NotEmpty" Text="grammar pool is not empty"/>
|
||||
<Message Id="XSer_StringPool_NotEmpty" Text="string pool is not empty"/>
|
||||
<Message Id="XSer_Storer_Loader_Mismatch" Text="storer level '{0}' does not match loader level '{1}'"/>
|
||||
<Message Id="VALUE_QName_Invalid2" Text="undefined prefix in QName value '{0}'"/>
|
||||
</FatalError>
|
||||
</MsgDomain>
|
||||
<MsgDomain Domain="http://apache.org/xml/messages/XMLDOMMsg">
|
||||
<FatalError>
|
||||
<!--The following are DOMException error text, same order as DOMException::ExceptionCode enum; do not remove them unless the corresponding enum is also removed -->
|
||||
<!--DOMEXCEPTION_ERRX is not an error, it's just used to indicate the start of DOMExceptionCode enum -->
|
||||
<Message Id="DOMEXCEPTION_ERRX" Text="dummy"/>
|
||||
<Message Id="INDEX_SIZE_ERR" Text="index or size is negative, or greater than the allowed value"/>
|
||||
<Message Id="DOMSTRING_SIZE_ERR" Text="specified range of text does not fit into DOMString"/>
|
||||
<Message Id="HIERARCHY_REQUEST_ERR" Text="attempt is made to insert a node where it is not permitted"/>
|
||||
<Message Id="WRONG_DOCUMENT_ERR" Text="node is used in a different document than the one that created it"/>
|
||||
<Message Id="INVALID_CHARACTER_ERR" Text="invalid or illegal XML character"/>
|
||||
<Message Id="NO_DATA_ALLOWED_ERR" Text="node does not support storing data"/>
|
||||
<Message Id="NO_MODIFICATION_ALLOWED_ERR" Text="attempt is made to modify an object where modifications are not allowed"/>
|
||||
<Message Id="NOT_FOUND_ERR" Text="attempt is made to reference a node in a context where it does not exist"/>
|
||||
<Message Id="NOT_SUPPORTED_ERR" Text="implementation does not support the requested type of object or operation"/>
|
||||
<Message Id="INUSE_ATTRIBUTE_ERR" Text="attempt is made to add an attribute that is already in use elsewhere"/>
|
||||
<Message Id="INVALID_STATE_ERR" Text="attempt is made to use an object that is not or is no longer usable"/>
|
||||
<Message Id="SYNTAX_ERR" Text="invalid or illegal string"/>
|
||||
<Message Id="INVALID_MODIFICATION_ERR" Text="attempt is made to modify the type of the underlying object"/>
|
||||
<Message Id="NAMESPACE_ERR" Text="attempt is made to create or change an object in a way which is incorrect with respect to namespaces"/>
|
||||
<Message Id="INVALID_ACCESS_ERR" Text="parameter or requested operation is not supported by the underlying object"/>
|
||||
<Message Id="VALIDATION_ERR" Text="call to a method such as insertBefore or removeChild would make the node invalid with respect to document grammar"/>
|
||||
<Message Id="TYPE_MISMATCH_ERR" Text="type of an object is incompatible with the expected type of the parameter associated with the object"/>
|
||||
<!--The following are DOMRangeException error text, same order as DOMRangeException::RangeExceptionCode enum -->
|
||||
<!--DOMRANGEEXCEPTION_ERRX is not an error, it's just used to indicate the start of DOMRangeException::RangeExceptionCode enum -->
|
||||
<Message Id="DOMRANGEEXCEPTION_ERRX" Text="dummy"/>
|
||||
<Message Id="BAD_BOUNDARYPOINTS_ERR" Text="boundary points of a range do not meet specific requirements"/>
|
||||
<Message Id="INVALID_NODE_TYPE_ERR" Text="container of a range boundary point is set to a node of an invalid type or to a node with an ancestor of an invalid type"/>
|
||||
<!--The following are DOMLSException error text, same order as DOMLSException::LSExceptionCode enum -->
|
||||
<!--DOMLSEXCEPTION_ERRX is not an error, it's just used to indicate the start of DOMLSException::LSExceptionCode enum -->
|
||||
<Message Id="DOMLSEXCEPTION_ERRX" Text="dummy"/>
|
||||
<Message Id="PARSE_ERR" Text="failed to load a document or an XML fragment using DOMLSParser"/>
|
||||
<Message Id="SERIALIZE_ERR" Text="failed to serialize a DOM node using DOMLSSerializer"/>
|
||||
<!--The following are DOMXPathException error text, same order as DOMXPathException::ExceptionCode enum -->
|
||||
<!--DOMXPATHEXCEPTION_ERRX is not an error, it's just used to indicate the start of DOMXPathException::ExceptionCode enum -->
|
||||
<Message Id="DOMXPATHEXCEPTION_ERRX" Text="dummy"/>
|
||||
<Message Id="INVALID_EXPRESSION_ERR" Text="expression has incorrect syntax or contains XPath features not supported by the XML Schema XPath subset"/>
|
||||
<Message Id="TYPE_ERR" Text="requested result type not supported"/>
|
||||
<Message Id="NO_RESULT_ERR" Text="no current result in the result object"/>
|
||||
<!--The following are other messages related to DOM -->
|
||||
<!--Messages used by DOMLSSerializer -->
|
||||
<Message Id="Writer_NestedCDATA" Text="nested CDATA sections"/>
|
||||
<Message Id="Writer_NotRepresentChar" Text="unrepresentable character"/>
|
||||
<Message Id="Writer_NotRecognizedType" Text="unrecognized node type"/>
|
||||
<!--Messages used by DOMLSParser -->
|
||||
<Message Id="LSParser_ParseInProgress" Text="parsing in progress"/>
|
||||
<Message Id="LSParser_ParsingAborted" Text="parsing aborted by the user"/>
|
||||
<Message Id="LSParser_ParsingFailed" Text="parsing failed"/>
|
||||
</FatalError>
|
||||
</MsgDomain>
|
||||
</MsgFile>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="US-ASCII" ?>
|
||||
|
||||
<!-- =====================================================================
|
||||
A message represents a single named message that can be loaded
|
||||
===================================================================== -->
|
||||
<!ELEMENT Message (#PCDATA)>
|
||||
<!ATTLIST Message
|
||||
Id CDATA #REQUIRED
|
||||
Text CDATA #REQUIRED>
|
||||
|
||||
|
||||
<!-- =====================================================================
|
||||
A message type represents groups of messages of the same severity
|
||||
===================================================================== -->
|
||||
<!ELEMENT Warning (Message*)>
|
||||
<!ELEMENT Error (Message*)>
|
||||
<!ELEMENT FatalError (Message*)>
|
||||
|
||||
|
||||
<!-- =====================================================================
|
||||
A message domain represents (optionally) a group of warnings, errors,
|
||||
and validity errors.
|
||||
===================================================================== -->
|
||||
<!ELEMENT MsgDomain (Warning?, Error?, FatalError?)>
|
||||
<!ATTLIST MsgDomain
|
||||
Domain CDATA #REQUIRED>
|
||||
|
||||
|
||||
<!-- =====================================================================
|
||||
A message file is the top level element, which contains all the
|
||||
general info about the messages contained, and the child elements
|
||||
that contain the various message domain.
|
||||
===================================================================== -->
|
||||
<!ELEMENT MsgFile (MsgDomain+)>
|
||||
<!ATTLIST MsgFile
|
||||
Locale CDATA #REQUIRED>
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOM.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOM_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOM_HPP
|
||||
|
||||
//
|
||||
// This is the primary header file for inclusion in application
|
||||
// programs using the C++ XML Document Object Model API.
|
||||
//
|
||||
|
||||
#include <xercesc/dom/DOMAttr.hpp>
|
||||
#include <xercesc/dom/DOMCDATASection.hpp>
|
||||
#include <xercesc/dom/DOMCharacterData.hpp>
|
||||
#include <xercesc/dom/DOMComment.hpp>
|
||||
#include <xercesc/dom/DOMDocument.hpp>
|
||||
#include <xercesc/dom/DOMDocumentFragment.hpp>
|
||||
#include <xercesc/dom/DOMDocumentType.hpp>
|
||||
#include <xercesc/dom/DOMElement.hpp>
|
||||
#include <xercesc/dom/DOMEntity.hpp>
|
||||
#include <xercesc/dom/DOMEntityReference.hpp>
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
#include <xercesc/dom/DOMImplementation.hpp>
|
||||
#include <xercesc/dom/DOMNamedNodeMap.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
#include <xercesc/dom/DOMNodeList.hpp>
|
||||
#include <xercesc/dom/DOMNotation.hpp>
|
||||
#include <xercesc/dom/DOMProcessingInstruction.hpp>
|
||||
#include <xercesc/dom/DOMText.hpp>
|
||||
|
||||
// Introduced in DOM Level 2
|
||||
#include <xercesc/dom/DOMDocumentRange.hpp>
|
||||
#include <xercesc/dom/DOMDocumentTraversal.hpp>
|
||||
#include <xercesc/dom/DOMNodeFilter.hpp>
|
||||
#include <xercesc/dom/DOMNodeIterator.hpp>
|
||||
#include <xercesc/dom/DOMRange.hpp>
|
||||
#include <xercesc/dom/DOMRangeException.hpp>
|
||||
#include <xercesc/dom/DOMTreeWalker.hpp>
|
||||
|
||||
// Introduced in DOM Level 3
|
||||
#include <xercesc/dom/DOMLSParser.hpp>
|
||||
#include <xercesc/dom/DOMLSParserFilter.hpp>
|
||||
#include <xercesc/dom/DOMConfiguration.hpp>
|
||||
#include <xercesc/dom/DOMLSResourceResolver.hpp>
|
||||
#include <xercesc/dom/DOMError.hpp>
|
||||
#include <xercesc/dom/DOMErrorHandler.hpp>
|
||||
#include <xercesc/dom/DOMImplementationLS.hpp>
|
||||
#include <xercesc/dom/DOMImplementationList.hpp>
|
||||
#include <xercesc/dom/DOMImplementationRegistry.hpp>
|
||||
#include <xercesc/dom/DOMImplementationSource.hpp>
|
||||
#include <xercesc/dom/DOMLSInput.hpp>
|
||||
#include <xercesc/dom/DOMLSOutput.hpp>
|
||||
#include <xercesc/dom/DOMLocator.hpp>
|
||||
#include <xercesc/dom/DOMPSVITypeInfo.hpp>
|
||||
#include <xercesc/dom/DOMStringList.hpp>
|
||||
#include <xercesc/dom/DOMTypeInfo.hpp>
|
||||
#include <xercesc/dom/DOMUserDataHandler.hpp>
|
||||
#include <xercesc/dom/DOMLSSerializer.hpp>
|
||||
#include <xercesc/dom/DOMLSSerializerFilter.hpp>
|
||||
|
||||
#include <xercesc/dom/DOMXPathEvaluator.hpp>
|
||||
#include <xercesc/dom/DOMXPathNSResolver.hpp>
|
||||
#include <xercesc/dom/DOMXPathException.hpp>
|
||||
#include <xercesc/dom/DOMXPathExpression.hpp>
|
||||
#include <xercesc/dom/DOMXPathResult.hpp>
|
||||
#include <xercesc/dom/DOMXPathNamespace.hpp>
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMAttr.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMATTR_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMATTR_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMElement;
|
||||
class DOMTypeInfo;
|
||||
|
||||
/**
|
||||
* The <code>DOMAttr</code> class refers to an attribute of an XML element.
|
||||
*
|
||||
* Typically the allowable values for the
|
||||
* attribute are defined in a documenttype definition.
|
||||
* <p><code>DOMAttr</code> objects inherit the <code>DOMNode</code> interface, but
|
||||
* since attributes are not actually child nodes of the elements they are associated with, the
|
||||
* DOM does not consider them part of the document tree. Thus, the
|
||||
* <code>DOMNode</code> attributes <code>parentNode</code>,
|
||||
* <code>previousSibling</code>, and <code>nextSibling</code> have a null
|
||||
* value for <code>DOMAttr</code> objects. The DOM takes the view that
|
||||
* attributes are properties of elements rather than having a separate
|
||||
* identity from the elements they are associated with; this should make it
|
||||
* more efficient to implement such features as default attributes associated
|
||||
* with all elements of a given type. Furthermore, attribute nodes
|
||||
* may not be immediate children of a <code>DOMDocumentFragment</code>. However,
|
||||
* they can be associated with <code>DOMElement</code> nodes contained within a
|
||||
* <code>DOMDocumentFragment</code>. In short, users of the DOM
|
||||
* need to be aware that <code>DOMAttr</code> nodes have some things in common
|
||||
* with other objects inheriting the <code>DOMNode</code> interface, but they
|
||||
* also are quite distinct.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
class CDOM_EXPORT DOMAttr: public DOMNode {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMAttr() {}
|
||||
DOMAttr(const DOMAttr &other) : DOMNode(other) {}
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented operators */
|
||||
//@{
|
||||
DOMAttr & operator = (const DOMAttr &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMAttr() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMAttr interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 1 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns the name of this attribute.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh * getName() const = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns true if the attribute received its value explicitly in the
|
||||
* XML document, or if a value was assigned programatically with
|
||||
* the setValue function. Returns false if the attribute value
|
||||
* came from the default value declared in the document's DTD.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual bool getSpecified() const = 0;
|
||||
|
||||
/**
|
||||
* Returns the value of the attribute.
|
||||
*
|
||||
* The value of the attribute is returned as a string.
|
||||
* Character and general entity references are replaced with their values.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh * getValue() const = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the value of the attribute. A text node with the unparsed contents
|
||||
* of the string will be created.
|
||||
*
|
||||
* @param value The value of the DOM attribute to be set
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual void setValue(const XMLCh *value) = 0;
|
||||
//@}
|
||||
|
||||
/** @name Functions introduced in DOM Level 2. */
|
||||
//@{
|
||||
/**
|
||||
* The <code>DOMElement</code> node this attribute is attached to or
|
||||
* <code>null</code> if this attribute is not in use.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMElement *getOwnerElement() const = 0;
|
||||
//@}
|
||||
|
||||
/** @name Functions introduced in DOM Level 3. */
|
||||
//@{
|
||||
/**
|
||||
* Returns whether this attribute is known to be of type ID or not.
|
||||
* When it is and its value is unique, the ownerElement of this attribute
|
||||
* can be retrieved using getElementById on DOMDocument.
|
||||
*
|
||||
* @return <code>bool</code> stating if this <code>DOMAttr</code> is an ID
|
||||
* @since DOM level 3
|
||||
*/
|
||||
virtual bool isId() const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the type information associated with this attribute.
|
||||
*
|
||||
* @return the <code>DOMTypeInfo</code> associated with this attribute
|
||||
* @since DOM level 3
|
||||
*/
|
||||
virtual const DOMTypeInfo * getSchemaTypeInfo() const = 0;
|
||||
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMCDATASection.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMCDATASECTION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMCDATASECTION_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMText.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* CDATA sections are used to escape blocks of text containing characters that
|
||||
* would otherwise be regarded as markup. The only delimiter that is
|
||||
* recognized in a CDATA section is the "]]>" string that ends the CDATA
|
||||
* section. CDATA sections cannot be nested. Their primary purpose is for
|
||||
* including material such as XML fragments, without needing to escape all
|
||||
* the delimiters.
|
||||
* <p>The <code>data</code> attribute of the <code>DOMText</code> node holds
|
||||
* the text that is contained by the CDATA section. Note that this may
|
||||
* contain characters that need to be escaped outside of CDATA sections and
|
||||
* that, depending on the character encoding ("charset") chosen for
|
||||
* serialization, it may be impossible to write out some characters as part
|
||||
* of a CDATA section.
|
||||
* <p>The <code>DOMCDATASection</code> interface inherits from the
|
||||
* <code>DOMCharacterData</code> interface through the <code>DOMText</code>
|
||||
* interface. Adjacent <code>DOMCDATASection</code> nodes are not merged by use
|
||||
* of the <code>normalize</code> method of the <code>DOMNode</code> interface.
|
||||
* Because no markup is recognized within a <code>DOMCDATASection</code>,
|
||||
* character numeric references cannot be used as an escape mechanism when
|
||||
* serializing. Therefore, action needs to be taken when serializing a
|
||||
* <code>DOMCDATASection</code> with a character encoding where some of the
|
||||
* contained characters cannot be represented. Failure to do so would not
|
||||
* produce well-formed XML.One potential solution in the serialization
|
||||
* process is to end the CDATA section before the character, output the
|
||||
* character using a character reference or entity reference, and open a new
|
||||
* CDATA section for any further characters in the text node. Note, however,
|
||||
* that some code conversion libraries at the time of writing do not return
|
||||
* an error or exception when a character is missing from the encoding,
|
||||
* making the task of ensuring that data is not corrupted on serialization
|
||||
* more difficult.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
class CDOM_EXPORT DOMCDATASection: public DOMText {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMCDATASection() {}
|
||||
DOMCDATASection(const DOMCDATASection &other) : DOMText(other) {}
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented operators */
|
||||
//@{
|
||||
DOMCDATASection & operator = (const DOMCDATASection &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMCDATASection() {};
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMCharacterData.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMCHARACTERDATA_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMCHARACTERDATA_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* The <code>DOMCharacterData</code> interface extends DOMNode with a set of
|
||||
* attributes and methods for accessing character data in the DOM. For
|
||||
* clarity this set is defined here rather than on each object that uses
|
||||
* these attributes and methods. No DOM objects correspond directly to
|
||||
* <code>DOMCharacterData</code>, though <code>DOMText</code> and others do
|
||||
* inherit the interface from it. All <code>offsets</code> in this interface
|
||||
* start from <code>0</code>.
|
||||
* <p>As explained in the DOM spec, text strings in
|
||||
* the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In
|
||||
* the following, the term 16-bit units is used whenever necessary to
|
||||
* indicate that indexing on DOMCharacterData is done in 16-bit units.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
class CDOM_EXPORT DOMCharacterData: public DOMNode {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMCharacterData() {}
|
||||
DOMCharacterData(const DOMCharacterData &other) : DOMNode(other) {}
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented operators */
|
||||
//@{
|
||||
DOMCharacterData & operator = (const DOMCharacterData &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMCharacterData() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMCharacterData interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 1 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns the character data of the node that implements this interface.
|
||||
*
|
||||
* The DOM implementation may not put arbitrary limits on the amount of data that
|
||||
* may be stored in a <code>DOMCharacterData</code> node. However,
|
||||
* implementation limits may mean that the entirety of a node's data may
|
||||
* not fit into a single <code>XMLCh* String</code>. In such cases, the user
|
||||
* may call <code>substringData</code> to retrieve the data in
|
||||
* appropriately sized pieces.
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh * getData() const = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of characters that are available through <code>data</code> and
|
||||
* the <code>substringData</code> method below.
|
||||
*
|
||||
* This may have the value
|
||||
* zero, i.e., <code>CharacterData</code> nodes may be empty.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual XMLSize_t getLength() const = 0;
|
||||
|
||||
/**
|
||||
* Extracts a range of data from the node.
|
||||
*
|
||||
* @param offset Start offset of substring to extract.
|
||||
* @param count The number of characters to extract.
|
||||
* @return The specified substring. If the sum of <code>offset</code> and
|
||||
* <code>count</code> exceeds the <code>length</code>, then all
|
||||
* characters to the end of the data are returned.
|
||||
* @exception DOMException
|
||||
* INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
|
||||
* than the number of characters in <code>data</code>, or if the
|
||||
* specified <code>count</code> is negative.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh * substringData(XMLSize_t offset,
|
||||
XMLSize_t count) const = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// String methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Append the string to the end of the character data of the node.
|
||||
*
|
||||
* Upon success, <code>data</code> provides access to the concatenation of
|
||||
* <code>data</code> and the <code>XMLCh* String</code> specified.
|
||||
* @param arg The <code>XMLCh* String</code> to append.
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual void appendData(const XMLCh *arg) = 0;
|
||||
|
||||
/**
|
||||
* Insert a string at the specified character offset.
|
||||
*
|
||||
* @param offset The character offset at which to insert.
|
||||
* @param arg The <code>XMLCh* String</code> to insert.
|
||||
* @exception DOMException
|
||||
* INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
|
||||
* than the number of characters in <code>data</code>.
|
||||
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual void insertData(XMLSize_t offset, const XMLCh *arg) = 0;
|
||||
|
||||
/**
|
||||
* Remove a range of characters from the node.
|
||||
*
|
||||
* Upon success,
|
||||
* <code>data</code> and <code>length</code> reflect the change.
|
||||
* @param offset The offset from which to remove characters.
|
||||
* @param count The number of characters to delete. If the sum of
|
||||
* <code>offset</code> and <code>count</code> exceeds <code>length</code>
|
||||
* then all characters from <code>offset</code> to the end of the data
|
||||
* are deleted.
|
||||
* @exception DOMException
|
||||
* INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
|
||||
* than the number of characters in <code>data</code>, or if the
|
||||
* specified <code>count</code> is negative.
|
||||
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual void deleteData(XMLSize_t offset,
|
||||
XMLSize_t count) = 0;
|
||||
|
||||
/**
|
||||
* Replace the characters starting at the specified character offset with
|
||||
* the specified string.
|
||||
*
|
||||
* @param offset The offset from which to start replacing.
|
||||
* @param count The number of characters to replace. If the sum of
|
||||
* <code>offset</code> and <code>count</code> exceeds <code>length</code>
|
||||
* , then all characters to the end of the data are replaced (i.e., the
|
||||
* effect is the same as a <code>remove</code> method call with the same
|
||||
* range, followed by an <code>append</code> method invocation).
|
||||
* @param arg The <code>XMLCh* String</code> with which the range must be
|
||||
* replaced.
|
||||
* @exception DOMException
|
||||
* INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
|
||||
* than the number of characters in <code>data</code>, or if the
|
||||
* specified <code>count</code> is negative.
|
||||
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual void replaceData(XMLSize_t offset,
|
||||
XMLSize_t count,
|
||||
const XMLCh *arg) = 0;
|
||||
|
||||
/**
|
||||
* Sets the character data of the node that implements this interface.
|
||||
*
|
||||
* @param data The <code>XMLCh* String</code> to set.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual void setData(const XMLCh *data) = 0;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMComment.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMCOMMENT_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMCOMMENT_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMCharacterData.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* This interface inherits from <code>CharacterData</code> and represents the
|
||||
* content of a comment, i.e., all the characters between the starting '
|
||||
* <code><!--</code>' and ending '<code>--></code>'.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
class CDOM_EXPORT DOMComment: public DOMCharacterData {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMComment() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMComment(const DOMComment &);
|
||||
DOMComment & operator = (const DOMComment &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMComment() {};
|
||||
//@}
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,454 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMCONFIGURATION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMCONFIGURATION_HPP
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Includes
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
#include <xercesc/util/RefVectorOf.hpp>
|
||||
#include <xercesc/dom/DOMStringList.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* The DOMConfiguration interface represents the configuration of
|
||||
* a document and maintains a table of recognized parameters.
|
||||
* Using the configuration, it is possible to change
|
||||
* Document.normalizeDocument behavior, such as replacing
|
||||
* CDATASection nodes with Text nodes or
|
||||
* specifying the type of the schema that must be used when the
|
||||
* validation of the Document is requested. DOMConfiguration
|
||||
* objects are also used in [DOM Level 3 Load and Save] in
|
||||
* the DOMLSParser and DOMLSSerializer interfaces.
|
||||
*
|
||||
* The DOMConfiguration distinguish two types of parameters:
|
||||
* boolean (boolean parameters) and DOMUserData
|
||||
* (parameters). The names used by the DOMConfiguration object are
|
||||
* defined throughout the DOM Level 3 specifications. Names are
|
||||
* case-insensitive. To avoid possible conflicts, as a
|
||||
* convention, names referring to boolean parameters and
|
||||
* parameters defined outside the DOM specification should be made
|
||||
* unique. Names are recommended to follow the XML name
|
||||
* production rule but it is not enforced by the DOM
|
||||
* implementation. DOM Level 3 Core Implementations are required
|
||||
* to recognize all boolean parameters and parameters defined in
|
||||
* this specification. Each boolean parameter state or parameter
|
||||
* value may then be supported or not by the implementation. Refer
|
||||
* to their definition to know if a state or a value must be
|
||||
* supported or not.
|
||||
*
|
||||
* Note: Parameters are similar to features and properties used in
|
||||
* SAX2 [SAX].
|
||||
*
|
||||
* The following list of parameters defined in the DOM:
|
||||
*
|
||||
* "error-handler"
|
||||
* [required]
|
||||
* A DOMErrorHandler object. If an error is
|
||||
* encountered in the document, the implementation will call
|
||||
* back the DOMErrorHandler registered using this
|
||||
* parameter.
|
||||
* When called, DOMError.relatedData will contain the
|
||||
* closest node to where the error occured. If the
|
||||
* implementation is unable to determine the node where the
|
||||
* error occurs, DOMError.relatedData will contain the
|
||||
* Document node. Mutations to the document from
|
||||
* within an error handler will result in implementation
|
||||
* dependent behaviour.
|
||||
*
|
||||
* "schema-type"
|
||||
* [optional]
|
||||
* A DOMString object containing an absolute URI and
|
||||
* representing the type of the schema language used to
|
||||
* validate a document against. Note that no lexical
|
||||
* checking is done on the absolute URI.
|
||||
* If this parameter is not set, a default value may be
|
||||
* provided by the implementation, based on the schema
|
||||
* languages supported and on the schema language used at
|
||||
* load time.
|
||||
*
|
||||
* Note: For XML Schema [XML Schema Part 1],
|
||||
* applications must use the value
|
||||
* "http://www.w3.org/2001/XMLSchema". For XML DTD
|
||||
* [XML 1.0], applications must use the value
|
||||
* "http://www.w3.org/TR/REC-xml". Other schema languages
|
||||
* are outside the scope of the W3C and therefore should
|
||||
* recommend an absolute URI in order to use this method.
|
||||
*
|
||||
* "schema-location"
|
||||
* [optional]
|
||||
* A DOMString object containing a list of URIs,
|
||||
* separated by white spaces (characters matching the
|
||||
* nonterminal production S defined in section 2.3
|
||||
* [XML 1.0]), that represents the schemas against
|
||||
* which validation should occur. The types of schemas
|
||||
* referenced in this list must match the type specified
|
||||
* with schema-type, otherwise the behaviour of an
|
||||
* implementation is undefined. If the schema type is XML
|
||||
* Schema [XML Schema Part 1], only one of the XML
|
||||
* Schemas in the list can be with no namespace.
|
||||
* If validation occurs against a namespace aware schema,
|
||||
* i.e. XML Schema, and the targetNamespace of a schema
|
||||
* (specified using this property) matches the
|
||||
* targetNamespace of a schema occurring in the instance
|
||||
* document, i.e in schemaLocation attribute, the schema
|
||||
* specified by the user using this property will be used
|
||||
* (i.e., in XML Schema the schemaLocation attribute in the
|
||||
* instance document or on the import element will be
|
||||
* effectively ignored).
|
||||
*
|
||||
* Note: It is illegal to set the schema-location parameter
|
||||
* if the schema-type parameter value is not set. It is
|
||||
* strongly recommended that DOMInputSource.baseURI will be
|
||||
* set, so that an implementation can successfully resolve
|
||||
* any external entities referenced.
|
||||
*
|
||||
* The following list of boolean parameters (features) defined in
|
||||
* the DOM:
|
||||
*
|
||||
* "canonical-form"
|
||||
*
|
||||
* true
|
||||
* [optional]
|
||||
* Canonicalize the document according to the rules
|
||||
* specified in [Canonical XML]. Note that this
|
||||
* is limited to what can be represented in the DOM.
|
||||
* In particular, there is no way to specify the order
|
||||
* of the attributes in the DOM.
|
||||
*
|
||||
* false
|
||||
* [required] (default)
|
||||
* Do not canonicalize the document.
|
||||
*
|
||||
* "cdata-sections"
|
||||
*
|
||||
* true
|
||||
* [required] (default)
|
||||
* Keep CDATASection nodes in the document.
|
||||
*
|
||||
* false
|
||||
* [required]
|
||||
* Transform CDATASection nodes in the document
|
||||
* into Text nodes. The new Text node is
|
||||
* then combined with any adjacent Text node.
|
||||
*
|
||||
* "comments"
|
||||
*
|
||||
* true
|
||||
* [required] (default)
|
||||
* Keep Comment nodes in the document.
|
||||
*
|
||||
* false
|
||||
* [required]
|
||||
* Discard Comment nodes in the Document.
|
||||
*
|
||||
* "datatype-normalization"
|
||||
*
|
||||
* true
|
||||
* [required]
|
||||
* Exposed normalized values in the tree.
|
||||
*
|
||||
* false
|
||||
* [required] (default)
|
||||
* Do not perform normalization on the tree.
|
||||
*
|
||||
* "discard-default-content"
|
||||
*
|
||||
* true
|
||||
* [required] (default)
|
||||
* Use whatever information available to the
|
||||
* implementation (i.e. XML schema, DTD, the specified
|
||||
* flag on Attr nodes, and so on) to decide what
|
||||
* attributes and content should be discarded or not.
|
||||
* Note that the specified flag on Attr nodes in
|
||||
* itself is not always reliable, it is only reliable
|
||||
* when it is set to false since the only case where
|
||||
* it can be set to false is if the attribute was
|
||||
* created by the implementation. The default content
|
||||
* won't be removed if an implementation does not have
|
||||
* any information available.
|
||||
*
|
||||
* false
|
||||
* [required]
|
||||
* Keep all attributes and all content.
|
||||
*
|
||||
* "entities"
|
||||
*
|
||||
* true
|
||||
* [required]
|
||||
* Keep EntityReference and Entity nodes
|
||||
* in the document.
|
||||
*
|
||||
* false
|
||||
* [required] (default)
|
||||
* Remove all EntityReference and Entity
|
||||
* nodes from the document, putting the entity
|
||||
* expansions directly in their place. Text
|
||||
* nodes are into "normal" form. Only
|
||||
* EntityReference nodes to non-defined entities
|
||||
* are kept in the document.
|
||||
*
|
||||
* "infoset"
|
||||
*
|
||||
* true
|
||||
* [required]
|
||||
* Only keep in the document the information defined
|
||||
* in the XML Information Set [XML Information
|
||||
* set].
|
||||
* This forces the following features to false:
|
||||
* namespace-declarations, validate-if-schema,
|
||||
* entities, datatype-normalization, cdata-sections.
|
||||
* This forces the following features to true:
|
||||
* whitespace-in-element-content, comments,
|
||||
* namespaces.
|
||||
* Other features are not changed unless explicitly
|
||||
* specified in the description of the features.
|
||||
* Note that querying this feature with getFeature
|
||||
* returns true only if the individual features
|
||||
* specified above are appropriately set.
|
||||
*
|
||||
* false
|
||||
* Setting infoset to false has no effect.
|
||||
*
|
||||
* "namespaces"
|
||||
*
|
||||
* true
|
||||
* [required] (default)
|
||||
* Perform the namespace processing as defined in
|
||||
* [XML Namespaces].
|
||||
*
|
||||
* false
|
||||
* [optional]
|
||||
* Do not perform the namespace processing.
|
||||
*
|
||||
* "namespace-declarations"
|
||||
*
|
||||
* true
|
||||
* [required] (default)
|
||||
* Include namespace declaration attributes, specified
|
||||
* or defaulted from the schema or the DTD, in the
|
||||
* document. See also the section Declaring
|
||||
* Namespaces in [XML Namespaces].
|
||||
*
|
||||
* false
|
||||
* [required]
|
||||
* Discard all namespace declaration attributes. The
|
||||
* Namespace prefixes are retained even if this
|
||||
* feature is set to false.
|
||||
*
|
||||
* "normalize-characters"
|
||||
*
|
||||
* true
|
||||
* [optional]
|
||||
* Perform the W3C Text Normalization of the
|
||||
* characters [CharModel] in the document.
|
||||
*
|
||||
* false
|
||||
* [required] (default)
|
||||
* Do not perform character normalization.
|
||||
*
|
||||
* "split-cdata-sections"
|
||||
*
|
||||
* true
|
||||
* [required] (default)
|
||||
* Split CDATA sections containing the CDATA section
|
||||
* termination marker ']]>'. When a CDATA section is
|
||||
* split a warning is issued.
|
||||
*
|
||||
* false
|
||||
* [required]
|
||||
* Signal an error if a CDATASection contains an
|
||||
* unrepresentable character.
|
||||
*
|
||||
* "validate"
|
||||
*
|
||||
* true
|
||||
* [optional]
|
||||
* Require the validation against a schema (i.e. XML
|
||||
* schema, DTD, any other type or representation of
|
||||
* schema) of the document as it is being normalized
|
||||
* as defined by [XML 1.0]. If validation errors
|
||||
* are found, or no schema was found, the error
|
||||
* handler is notified. Note also that normalized
|
||||
* values will not be exposed to the schema in used
|
||||
* unless the feature datatype-normalization is true.
|
||||
*
|
||||
* Note: validate-if-schema and validate are mutually
|
||||
* exclusive, setting one of them to true will set the
|
||||
* other one to false.
|
||||
*
|
||||
* false
|
||||
* [required] (default)
|
||||
* Only XML 1.0 non-validating processing must be
|
||||
* done. Note that validation might still happen if
|
||||
* validate-if-schema is true.
|
||||
*
|
||||
* "validate-if-schema"
|
||||
*
|
||||
* true
|
||||
* [optional]
|
||||
* Enable validation only if a declaration for the
|
||||
* document element can be found (independently of
|
||||
* where it is found, i.e. XML schema, DTD, or any
|
||||
* other type or representation of schema). If
|
||||
* validation errors are found, the error handler is
|
||||
* notified. Note also that normalized values will not
|
||||
* be exposed to the schema in used unless the feature
|
||||
* datatype-normalization is true.
|
||||
*
|
||||
* Note: validate-if-schema and validate are mutually
|
||||
* exclusive, setting one of them to true will set the
|
||||
* other one to false.
|
||||
*
|
||||
* false
|
||||
* [required] (default)
|
||||
* No validation should be performed if the document
|
||||
* has a schema. Note that validation must still
|
||||
* happen if validate is true.
|
||||
*
|
||||
* "element-content-whitespace"
|
||||
*
|
||||
* true
|
||||
* [required] (default)
|
||||
* Keep all white spaces in the document.
|
||||
*
|
||||
* false
|
||||
* [optional]
|
||||
* Discard white space in element content while
|
||||
* normalizing. The implementation is expected to use
|
||||
* the isWhitespaceInElementContent flag on Text
|
||||
* nodes to determine if a text node should be written
|
||||
* out or not.
|
||||
*
|
||||
* The resolutions of entities is done using Document.baseURI.
|
||||
* However, when the features "LS-Load" or "LS-Save" defined in
|
||||
* [DOM Level 3 Load and Save] are supported by the DOM
|
||||
* implementation, the parameter "entity-resolver" can also be
|
||||
* used on DOMConfiguration objects attached to Document
|
||||
* nodes. If this parameter is set,
|
||||
* Document.normalizeDocument will invoke the entity
|
||||
* resolver instead of using Document.baseURI.
|
||||
*/
|
||||
class CDOM_EXPORT DOMConfiguration
|
||||
{
|
||||
protected:
|
||||
//-----------------------------------------------------------------------------------
|
||||
// Constructor
|
||||
//-----------------------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMConfiguration() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMConfiguration(const DOMConfiguration &);
|
||||
DOMConfiguration & operator = (const DOMConfiguration &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** Set the value of a parameter.
|
||||
* @param name The name of the parameter to set.
|
||||
* @param value The new value or null if the user wishes to unset the
|
||||
* parameter. While the type of the value parameter is defined as
|
||||
* <code>DOMUserData</code>, the object type must match the type defined
|
||||
* by the definition of the parameter. For example, if the parameter is
|
||||
* "error-handler", the value must be of type <code>DOMErrorHandler</code>
|
||||
* @exception DOMException (NOT_SUPPORTED_ERR) Raised when the
|
||||
* parameter name is recognized but the requested value cannot be set.
|
||||
* @exception DOMException (NOT_FOUND_ERR) Raised when the
|
||||
* parameter name is not recognized.
|
||||
* @since DOM level 3
|
||||
**/
|
||||
virtual void setParameter(const XMLCh* name, const void* value) = 0;
|
||||
virtual void setParameter(const XMLCh* name, bool value) = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/** Return the value of a parameter if known.
|
||||
* @param name The name of the parameter.
|
||||
* @return The current object associated with the specified parameter or
|
||||
* null if no object has been associated or if the parameter is not
|
||||
* supported.
|
||||
* @exception DOMException (NOT_FOUND_ERR) Raised when the i
|
||||
* boolean parameter
|
||||
* name is not recognized.
|
||||
* @since DOM level 3
|
||||
**/
|
||||
virtual const void* getParameter(const XMLCh* name) const = 0;
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Query methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** Check if setting a parameter to a specific value is supported.
|
||||
* @param name The name of the parameter to check.
|
||||
* @param value An object. if null, the returned value is true.
|
||||
* @return true if the parameter could be successfully set to the specified
|
||||
* value, or false if the parameter is not recognized or the requested value
|
||||
* is not supported. This does not change the current value of the parameter
|
||||
* itself.
|
||||
* @since DOM level 3
|
||||
**/
|
||||
virtual bool canSetParameter(const XMLCh* name, const void* value) const = 0;
|
||||
virtual bool canSetParameter(const XMLCh* name, bool value) const = 0;
|
||||
|
||||
/**
|
||||
* The list of the parameters supported by this DOMConfiguration object and
|
||||
* for which at least one value can be set by the application.
|
||||
* Note that this list can also contain parameter names defined outside this specification.
|
||||
*
|
||||
* @return The list of parameters that can be used with setParameter/getParameter
|
||||
* @since DOM level 3
|
||||
**/
|
||||
virtual const DOMStringList* getParameterNames() const = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMConfiguration() {};
|
||||
//@}
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* End of file DOMConfiguration.hpp
|
||||
*/
|
||||
@@ -0,0 +1,819 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMDocument.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENT_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMDOCUMENT_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
#include <xercesc/dom/DOMDocumentRange.hpp>
|
||||
#include <xercesc/dom/DOMDocumentTraversal.hpp>
|
||||
#include <xercesc/dom/DOMXPathEvaluator.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMConfiguration;
|
||||
class DOMDocumentType;
|
||||
class DOMElement;
|
||||
class DOMDocumentFragment;
|
||||
class DOMComment;
|
||||
class DOMCDATASection;
|
||||
class DOMProcessingInstruction;
|
||||
class DOMAttr;
|
||||
class DOMEntity;
|
||||
class DOMEntityReference;
|
||||
class DOMImplementation;
|
||||
class DOMNodeFilter;
|
||||
class DOMNodeList;
|
||||
class DOMNotation;
|
||||
class DOMText;
|
||||
class DOMNode;
|
||||
|
||||
|
||||
/**
|
||||
* The <code>DOMDocument</code> interface represents the entire XML
|
||||
* document. Conceptually, it is the root of the document tree, and provides
|
||||
* the primary access to the document's data.
|
||||
* <p>Since elements, text nodes, comments, processing instructions, etc.
|
||||
* cannot exist outside the context of a <code>DOMDocument</code>, the
|
||||
* <code>DOMDocument</code> interface also contains the factory methods needed
|
||||
* to create these objects. The <code>DOMNode</code> objects created have a
|
||||
* <code>ownerDocument</code> attribute which associates them with the
|
||||
* <code>DOMDocument</code> within whose context they were created.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
|
||||
*/
|
||||
|
||||
class CDOM_EXPORT DOMDocument: public DOMDocumentRange,
|
||||
public DOMXPathEvaluator,
|
||||
public DOMDocumentTraversal,
|
||||
public DOMNode {
|
||||
|
||||
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMDocument() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMDocument(const DOMDocument &);
|
||||
DOMDocument & operator = (const DOMDocument &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMDocument() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMDocument interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 1 */
|
||||
//@{
|
||||
/**
|
||||
* Creates an element of the type specified. Note that the instance
|
||||
* returned implements the <code>DOMElement</code> interface, so attributes
|
||||
* can be specified directly on the returned object.
|
||||
* <br>In addition, if there are known attributes with default values,
|
||||
* <code>DOMAttr</code> nodes representing them are automatically created
|
||||
* and attached to the element.
|
||||
* <br>To create an element with a qualified name and namespace URI, use
|
||||
* the <code>createElementNS</code> method.
|
||||
* @param tagName The name of the element type to instantiate. For XML,
|
||||
* this is case-sensitive.
|
||||
* @return A new <code>DOMElement</code> object with the
|
||||
* <code>nodeName</code> attribute set to <code>tagName</code>, and
|
||||
* <code>localName</code>, <code>prefix</code>, and
|
||||
* <code>namespaceURI</code> set to <code>null</code>.
|
||||
* @exception DOMException
|
||||
* INVALID_CHARACTER_ERR: Raised if the specified name contains an
|
||||
* illegal character.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMElement *createElement(const XMLCh *tagName) = 0;
|
||||
|
||||
/**
|
||||
* Creates an empty <code>DOMDocumentFragment</code> object.
|
||||
* @return A new <code>DOMDocumentFragment</code>.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMDocumentFragment *createDocumentFragment() = 0;
|
||||
|
||||
/**
|
||||
* Creates a <code>DOMText</code> node given the specified string.
|
||||
* @param data The data for the node.
|
||||
* @return The new <code>DOMText</code> object.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMText *createTextNode(const XMLCh *data) = 0;
|
||||
|
||||
/**
|
||||
* Creates a <code>DOMComment</code> node given the specified string.
|
||||
* @param data The data for the node.
|
||||
* @return The new <code>DOMComment</code> object.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMComment *createComment(const XMLCh *data) = 0;
|
||||
|
||||
/**
|
||||
* Creates a <code>DOMCDATASection</code> node whose value is the specified
|
||||
* string.
|
||||
* @param data The data for the <code>DOMCDATASection</code> contents.
|
||||
* @return The new <code>DOMCDATASection</code> object.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMCDATASection *createCDATASection(const XMLCh *data) = 0;
|
||||
|
||||
/**
|
||||
* Creates a <code>DOMProcessingInstruction</code> node given the specified
|
||||
* name and data strings.
|
||||
* @param target The target part of the processing instruction.
|
||||
* @param data The data for the node.
|
||||
* @return The new <code>DOMProcessingInstruction</code> object.
|
||||
* @exception DOMException
|
||||
* INVALID_CHARACTER_ERR: Raised if the specified target contains an
|
||||
* illegal character.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMProcessingInstruction *createProcessingInstruction(const XMLCh *target,
|
||||
const XMLCh *data) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Creates an <code>DOMAttr</code> of the given name. Note that the
|
||||
* <code>DOMAttr</code> instance can then be set on an <code>DOMElement</code>
|
||||
* using the <code>setAttributeNode</code> method.
|
||||
* <br>To create an attribute with a qualified name and namespace URI, use
|
||||
* the <code>createAttributeNS</code> method.
|
||||
* @param name The name of the attribute.
|
||||
* @return A new <code>DOMAttr</code> object with the <code>nodeName</code>
|
||||
* attribute set to <code>name</code>, and <code>localName</code>,
|
||||
* <code>prefix</code>, and <code>namespaceURI</code> set to
|
||||
* <code>null</code>. The value of the attribute is the empty string.
|
||||
* @exception DOMException
|
||||
* INVALID_CHARACTER_ERR: Raised if the specified name contains an
|
||||
* illegal character.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMAttr *createAttribute(const XMLCh *name) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Creates an <code>DOMEntityReference</code> object. In addition, if the
|
||||
* referenced entity is known, the child list of the
|
||||
* <code>DOMEntityReference</code> node is made the same as that of the
|
||||
* corresponding <code>DOMEntity</code> node.If any descendant of the
|
||||
* <code>DOMEntity</code> node has an unbound namespace prefix, the
|
||||
* corresponding descendant of the created <code>DOMEntityReference</code>
|
||||
* node is also unbound; (its <code>namespaceURI</code> is
|
||||
* <code>null</code>). The DOM Level 2 does not support any mechanism to
|
||||
* resolve namespace prefixes.
|
||||
* @param name The name of the entity to reference.
|
||||
* @return The new <code>DOMEntityReference</code> object.
|
||||
* @exception DOMException
|
||||
* INVALID_CHARACTER_ERR: Raised if the specified name contains an
|
||||
* illegal character.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMEntityReference *createEntityReference(const XMLCh *name) = 0;
|
||||
|
||||
/**
|
||||
* The Document Type Declaration (see <code>DOMDocumentType</code>)
|
||||
* associated with this document. For XML
|
||||
* documents without a document type declaration this returns
|
||||
* <code>null</code>. The DOM Level 2 does not support editing the
|
||||
* Document Type Declaration. <code>docType</code> cannot be altered in
|
||||
* any way, including through the use of methods inherited from the
|
||||
* <code>DOMNode</code> interface, such as <code>insertNode</code> or
|
||||
* <code>removeNode</code>.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMDocumentType *getDoctype() const = 0;
|
||||
|
||||
/**
|
||||
* The <code>DOMImplementation</code> object that handles this document. A
|
||||
* DOM application may use objects from multiple implementations.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMImplementation *getImplementation() const = 0;
|
||||
|
||||
/**
|
||||
* This is a convenience attribute that allows direct access to the child
|
||||
* node that is the root element of the document.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMElement *getDocumentElement() const = 0;
|
||||
|
||||
/**
|
||||
* Returns a <code>DOMNodeList</code> of all the <code>DOMElement(s)</code> with a
|
||||
* given tag name in the order in which they are encountered in a
|
||||
* preorder traversal of the <code>DOMDocument</code> tree.
|
||||
*
|
||||
* The returned node list is "live", in that changes
|
||||
* to the document tree made after a nodelist was initially
|
||||
* returned will be immediately reflected in the node list.
|
||||
* @param tagname The name of the tag to match on. The special value "*"
|
||||
* matches all tags.
|
||||
* @return A new <code>DOMNodeList</code> object containing all the matched
|
||||
* <code>DOMElement(s)</code>.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNodeList *getElementsByTagName(const XMLCh *tagname) const = 0;
|
||||
|
||||
//@}
|
||||
|
||||
/** @name Functions introduced in DOM Level 2. */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Imports a node from another document to this document. The returned
|
||||
* node has no parent; (<code>parentNode</code> is <code>null</code>).
|
||||
* The source node is not altered or removed from the original document;
|
||||
* this method creates a new copy of the source node.
|
||||
* <br>For all nodes, importing a node creates a node object owned by the
|
||||
* importing document, with attribute values identical to the source
|
||||
* node's <code>nodeName</code> and <code>nodeType</code>, plus the
|
||||
* attributes related to namespaces (<code>prefix</code>,
|
||||
* <code>localName</code>, and <code>namespaceURI</code>). As in the
|
||||
* <code>cloneNode</code> operation on a <code>DOMNode</code>, the source
|
||||
* node is not altered.
|
||||
* <br>Additional information is copied as appropriate to the
|
||||
* <code>nodeType</code>, attempting to mirror the behavior expected if
|
||||
* a fragment of XML source was copied from one document to
|
||||
* another, recognizing that the two documents may have different DTDs
|
||||
* in the XML case. The following list describes the specifics for each
|
||||
* type of node.
|
||||
* <dl>
|
||||
* <dt>ATTRIBUTE_NODE</dt>
|
||||
* <dd>The <code>ownerElement</code> attribute
|
||||
* is set to <code>null</code> and the <code>specified</code> flag is
|
||||
* set to <code>true</code> on the generated <code>DOMAttr</code>. The
|
||||
* descendants of the source <code>DOMAttr</code> are recursively imported
|
||||
* and the resulting nodes reassembled to form the corresponding subtree.
|
||||
* Note that the <code>deep</code> parameter has no effect on
|
||||
* <code>DOMAttr</code> nodes; they always carry their children with them
|
||||
* when imported.</dd>
|
||||
* <dt>DOCUMENT_FRAGMENT_NODE</dt>
|
||||
* <dd>If the <code>deep</code> option
|
||||
* was set to <code>true</code>, the descendants of the source element
|
||||
* are recursively imported and the resulting nodes reassembled to form
|
||||
* the corresponding subtree. Otherwise, this simply generates an empty
|
||||
* <code>DOMDocumentFragment</code>.</dd>
|
||||
* <dt>DOCUMENT_NODE</dt>
|
||||
* <dd><code>DOMDocument</code>
|
||||
* nodes cannot be imported.</dd>
|
||||
* <dt>DOCUMENT_TYPE_NODE</dt>
|
||||
* <dd><code>DOMDocumentType</code>
|
||||
* nodes cannot be imported.</dd>
|
||||
* <dt>ELEMENT_NODE</dt>
|
||||
* <dd>Specified attribute nodes of the
|
||||
* source element are imported, and the generated <code>DOMAttr</code>
|
||||
* nodes are attached to the generated <code>DOMElement</code>. Default
|
||||
* attributes are not copied, though if the document being imported into
|
||||
* defines default attributes for this element name, those are assigned.
|
||||
* If the <code>importNode</code> <code>deep</code> parameter was set to
|
||||
* <code>true</code>, the descendants of the source element are
|
||||
* recursively imported and the resulting nodes reassembled to form the
|
||||
* corresponding subtree.</dd>
|
||||
* <dt>ENTITY_NODE</dt>
|
||||
* <dd><code>DOMEntity</code> nodes can be
|
||||
* imported, however in the current release of the DOM the
|
||||
* <code>DOMDocumentType</code> is readonly. Ability to add these imported
|
||||
* nodes to a <code>DOMDocumentType</code> will be considered for addition
|
||||
* to a future release of the DOM.On import, the <code>publicId</code>,
|
||||
* <code>systemId</code>, and <code>notationName</code> attributes are
|
||||
* copied. If a <code>deep</code> import is requested, the descendants
|
||||
* of the the source <code>DOMEntity</code> are recursively imported and
|
||||
* the resulting nodes reassembled to form the corresponding subtree.</dd>
|
||||
* <dt>
|
||||
* ENTITY_REFERENCE_NODE</dt>
|
||||
* <dd>Only the <code>DOMEntityReference</code> itself is
|
||||
* copied, even if a <code>deep</code> import is requested, since the
|
||||
* source and destination documents might have defined the entity
|
||||
* differently. If the document being imported into provides a
|
||||
* definition for this entity name, its value is assigned.</dd>
|
||||
* <dt>NOTATION_NODE</dt>
|
||||
* <dd>
|
||||
* <code>DOMNotation</code> nodes can be imported, however in the current
|
||||
* release of the DOM the <code>DOMDocumentType</code> is readonly. Ability
|
||||
* to add these imported nodes to a <code>DOMDocumentType</code> will be
|
||||
* considered for addition to a future release of the DOM.On import, the
|
||||
* <code>publicId</code> and <code>systemId</code> attributes are copied.
|
||||
* Note that the <code>deep</code> parameter has no effect on
|
||||
* <code>DOMNotation</code> nodes since they never have any children.</dd>
|
||||
* <dt>
|
||||
* PROCESSING_INSTRUCTION_NODE</dt>
|
||||
* <dd>The imported node copies its
|
||||
* <code>target</code> and <code>data</code> values from those of the
|
||||
* source node.</dd>
|
||||
* <dt>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE</dt>
|
||||
* <dd>These three
|
||||
* types of nodes inheriting from <code>DOMCharacterData</code> copy their
|
||||
* <code>data</code> and <code>length</code> attributes from those of
|
||||
* the source node.</dd>
|
||||
* </dl>
|
||||
* @param importedNode The node to import.
|
||||
* @param deep If <code>true</code>, recursively import the subtree under
|
||||
* the specified node; if <code>false</code>, import only the node
|
||||
* itself, as explained above. This has no effect on <code>DOMAttr</code>
|
||||
* , <code>DOMEntityReference</code>, and <code>DOMNotation</code> nodes.
|
||||
* @return The imported node that belongs to this <code>DOMDocument</code>.
|
||||
* @exception DOMException
|
||||
* NOT_SUPPORTED_ERR: Raised if the type of node being imported is not
|
||||
* supported.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode *importNode(const DOMNode *importedNode, bool deep) = 0;
|
||||
|
||||
/**
|
||||
* Creates an element of the given qualified name and namespace URI.
|
||||
* @param namespaceURI The namespace URI of the element to create.
|
||||
* @param qualifiedName The qualified name of the element type to
|
||||
* instantiate.
|
||||
* @return A new <code>DOMElement</code> object with the following
|
||||
* attributes:
|
||||
* <table border='1'>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'><code>Attribute</code></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>
|
||||
* <code>Value</code></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'><code>DOMNode.nodeName</code></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>
|
||||
* <code>qualifiedName</code></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'><code>DOMNode.namespaceURI</code></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>
|
||||
* <code>namespaceURI</code></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'><code>DOMNode.prefix</code></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>prefix, extracted
|
||||
* from <code>qualifiedName</code>, or <code>null</code> if there is
|
||||
* no prefix</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'><code>DOMNode.localName</code></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>local name, extracted from
|
||||
* <code>qualifiedName</code></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'><code>DOMElement.tagName</code></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>
|
||||
* <code>qualifiedName</code></td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* @exception DOMException
|
||||
* INVALID_CHARACTER_ERR: Raised if the specified qualified name
|
||||
* contains an illegal character, per the XML 1.0 specification .
|
||||
* <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
|
||||
* malformed per the Namespaces in XML specification, if the
|
||||
* <code>qualifiedName</code> has a prefix and the
|
||||
* <code>namespaceURI</code> is <code>null</code>, or if the
|
||||
* <code>qualifiedName</code> has a prefix that is "xml" and the
|
||||
* <code>namespaceURI</code> is different from "
|
||||
* http://www.w3.org/XML/1998/namespace" .
|
||||
* <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
|
||||
* support the <code>"XML"</code> feature, since namespaces were
|
||||
* defined by XML.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMElement *createElementNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *qualifiedName) = 0;
|
||||
|
||||
/**
|
||||
* Creates an attribute of the given qualified name and namespace URI.
|
||||
* @param namespaceURI The namespace URI of the attribute to create.
|
||||
* @param qualifiedName The qualified name of the attribute to
|
||||
* instantiate.
|
||||
* @return A new <code>DOMAttr</code> object with the following attributes:
|
||||
* <table border='1'>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'><code>Attribute</code></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>
|
||||
* <code>Value</code></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'><code>DOMNode.nodeName</code></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>qualifiedName</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>
|
||||
* <code>DOMNode.namespaceURI</code></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'><code>namespaceURI</code></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>
|
||||
* <code>DOMNode.prefix</code></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>prefix, extracted from
|
||||
* <code>qualifiedName</code>, or <code>null</code> if there is no
|
||||
* prefix</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'><code>DOMNode.localName</code></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>local name, extracted from
|
||||
* <code>qualifiedName</code></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'><code>DOMAttr.name</code></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>
|
||||
* <code>qualifiedName</code></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'><code>DOMNode.nodeValue</code></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>the empty
|
||||
* string</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* @exception DOMException
|
||||
* INVALID_CHARACTER_ERR: Raised if the specified qualified name
|
||||
* contains an illegal character, per the XML 1.0 specification .
|
||||
* <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
|
||||
* malformed per the Namespaces in XML specification, if the
|
||||
* <code>qualifiedName</code> has a prefix and the
|
||||
* <code>namespaceURI</code> is <code>null</code>, if the
|
||||
* <code>qualifiedName</code> has a prefix that is "xml" and the
|
||||
* <code>namespaceURI</code> is different from "
|
||||
* http://www.w3.org/XML/1998/namespace", or if the
|
||||
* <code>qualifiedName</code>, or its prefix, is "xmlns" and the
|
||||
* <code>namespaceURI</code> is different from "
|
||||
* http://www.w3.org/2000/xmlns/".
|
||||
* <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
|
||||
* support the <code>"XML"</code> feature, since namespaces were
|
||||
* defined by XML.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMAttr *createAttributeNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *qualifiedName) = 0;
|
||||
|
||||
/**
|
||||
* Returns a <code>DOMNodeList</code> of all the <code>DOMElement(s)</code> with a
|
||||
* given local name and namespace URI in the order in which they are
|
||||
* encountered in a preorder traversal of the <code>DOMDocument</code> tree.
|
||||
* @param namespaceURI The namespace URI of the elements to match on. The
|
||||
* special value "*" matches all namespaces.
|
||||
* @param localName The local name of the elements to match on. The
|
||||
* special value "*" matches all local names.
|
||||
* @return A new <code>DOMNodeList</code> object containing all the matched
|
||||
* <code>DOMElement(s)</code>.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNodeList *getElementsByTagNameNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the <code>DOMElement</code> whose <code>ID</code> is given by
|
||||
* <code>elementId</code>. If no such element exists, returns
|
||||
* <code>null</code>. Behavior is not defined if more than one element
|
||||
* has this <code>ID</code>. The DOM implementation must have
|
||||
* information that says which attributes are of type ID. Attributes
|
||||
* with the name "ID" are not of type ID unless so defined.
|
||||
* Implementations that do not know whether attributes are of type ID or
|
||||
* not are expected to return <code>null</code>.
|
||||
* @param elementId The unique <code>id</code> value for an element.
|
||||
* @return The matching element.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMElement * getElementById(const XMLCh *elementId) const = 0;
|
||||
//@}
|
||||
|
||||
/** @name Functions introduced in DOM Level 3. */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* An attribute specifying the encoding used for this document at the time of the parsing.
|
||||
* This is <code>null</code> when it is not known, such as when the DOMDocument was created in memory.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getInputEncoding() const = 0;
|
||||
|
||||
/**
|
||||
* An attribute specifying, as part of the XML declaration, the encoding of this document.
|
||||
* This is <code>null</code> when unspecified or when it is not known, such as when the
|
||||
* DOMDocument was created in memory.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getXmlEncoding() const = 0;
|
||||
|
||||
/**
|
||||
* An attribute specifying, as part of the XML declaration, whether this document is standalone.
|
||||
* This is <code>false</code> when unspecified.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual bool getXmlStandalone() const = 0;
|
||||
|
||||
/**
|
||||
* An attribute specifying, as part of the XML declaration, whether this
|
||||
* document is standalone.
|
||||
* <br> This attribute represents the property [standalone] defined in .
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setXmlStandalone(bool standalone) = 0;
|
||||
|
||||
/**
|
||||
* An attribute specifying, as part of the XML declaration, the version
|
||||
* number of this document. This is <code>null</code> when unspecified.
|
||||
* <br> This attribute represents the property [version] defined in .
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getXmlVersion() const = 0;
|
||||
|
||||
/**
|
||||
* An attribute specifying, as part of the XML declaration, the version
|
||||
* number of this document. This is <code>null</code> when unspecified.
|
||||
* <br> This attribute represents the property [version] defined in .
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setXmlVersion(const XMLCh* version) = 0;
|
||||
|
||||
/**
|
||||
* The location of the document or <code>null</code> if undefined.
|
||||
* <br>Beware that when the <code>DOMDocument</code> supports the feature
|
||||
* "HTML" , the href attribute of the HTML BASE element takes precedence
|
||||
* over this attribute.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getDocumentURI() const = 0;
|
||||
/**
|
||||
* The location of the document or <code>null</code> if undefined.
|
||||
* <br>Beware that when the <code>DOMDocument</code> supports the feature
|
||||
* "HTML" , the href attribute of the HTML BASE element takes precedence
|
||||
* over this attribute.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setDocumentURI(const XMLCh* documentURI) = 0;
|
||||
|
||||
/**
|
||||
* An attribute specifying whether errors checking is enforced or not.
|
||||
* When set to <code>false</code>, the implementation is free to not
|
||||
* test every possible error case normally defined on DOM operations,
|
||||
* and not raise any <code>DOMException</code>. In case of error, the
|
||||
* behavior is undefined. This attribute is <code>true</code> by
|
||||
* defaults.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual bool getStrictErrorChecking() const = 0;
|
||||
/**
|
||||
* An attribute specifying whether errors checking is enforced or not.
|
||||
* When set to <code>false</code>, the implementation is free to not
|
||||
* test every possible error case normally defined on DOM operations,
|
||||
* and not raise any <code>DOMException</code>. In case of error, the
|
||||
* behavior is undefined. This attribute is <code>true</code> by
|
||||
* defaults.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setStrictErrorChecking(bool strictErrorChecking) = 0;
|
||||
|
||||
/**
|
||||
* Rename an existing node. When possible this simply changes the name of
|
||||
* the given node, otherwise this creates a new node with the specified
|
||||
* name and replaces the existing node with the new node as described
|
||||
* below. This only applies to nodes of type <code>ELEMENT_NODE</code>
|
||||
* and <code>ATTRIBUTE_NODE</code>.
|
||||
* <br>When a new node is created, the following operations are performed:
|
||||
* the new node is created, any registered event listener is registered
|
||||
* on the new node, any user data attached to the old node is removed
|
||||
* from that node, the old node is removed from its parent if it has
|
||||
* one, the children are moved to the new node, if the renamed node is
|
||||
* an <code>DOMElement</code> its attributes are moved to the new node, the
|
||||
* new node is inserted at the position the old node used to have in its
|
||||
* parent's child nodes list if it has one, the user data that was
|
||||
* attached to the old node is attach to the new node, the user data
|
||||
* event <code>NODE_RENAMED</code> is fired.
|
||||
* <br>When the node being renamed is an <code>DOMAttr</code> that is
|
||||
* attached to an <code>DOMElement</code>, the node is first removed from
|
||||
* the <code>DOMElement</code> attributes map. Then, once renamed, either
|
||||
* by modifying the existing node or creating a new one as described
|
||||
* above, it is put back.
|
||||
*
|
||||
* @param n The node to rename.
|
||||
* @param namespaceURI The new namespaceURI.
|
||||
* @param qualifiedName The new qualified name.
|
||||
* @return The renamed node. This is either the specified node or the new
|
||||
* node that was created to replace the specified node.
|
||||
* @exception DOMException
|
||||
* NOT_SUPPORTED_ERR: Raised when the type of the specified node is
|
||||
* neither <code>ELEMENT_NODE</code> nor <code>ATTRIBUTE_NODE</code>.
|
||||
* <br>WRONG_DOCUMENT_ERR: Raised when the specified node was created
|
||||
* from a different document than this document.
|
||||
* <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
|
||||
* malformed per the Namespaces in XML specification, if the
|
||||
* <code>qualifiedName</code> has a prefix and the
|
||||
* <code>namespaceURI</code> is <code>null</code>, or if the
|
||||
* <code>qualifiedName</code> has a prefix that is "xml" and the
|
||||
* <code>namespaceURI</code> is different from "
|
||||
* http://www.w3.org/XML/1998/namespace" . Also raised, when the node
|
||||
* being renamed is an attribute, if the <code>qualifiedName</code>,
|
||||
* or its prefix, is "xmlns" and the <code>namespaceURI</code> is
|
||||
* different from "http://www.w3.org/2000/xmlns/".
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMNode* renameNode(DOMNode* n, const XMLCh* namespaceURI, const XMLCh* qualifiedName) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Changes the <code>ownerDocument</code> of a node, its children, as well
|
||||
* as the attached attribute nodes if there are any. If the node has a
|
||||
* parent it is first removed from its parent child list. This
|
||||
* effectively allows moving a subtree from one document to another. The
|
||||
* following list describes the specifics for each type of node.
|
||||
*
|
||||
* <dl>
|
||||
* <dt>
|
||||
* ATTRIBUTE_NODE</dt>
|
||||
* <dd>The <code>ownerElement</code> attribute is set to
|
||||
* <code>null</code> and the <code>specified</code> flag is set to
|
||||
* <code>true</code> on the adopted <code>DOMAttr</code>. The descendants
|
||||
* of the source <code>DOMAttr</code> are recursively adopted.</dd>
|
||||
* <dt>
|
||||
* DOCUMENT_FRAGMENT_NODE</dt>
|
||||
* <dd>The descendants of the source node are
|
||||
* recursively adopted.</dd>
|
||||
* <dt>DOCUMENT_NODE</dt>
|
||||
* <dd><code>DOMDocument</code> nodes cannot
|
||||
* be adopted.</dd>
|
||||
* <dt>DOCUMENT_TYPE_NODE</dt>
|
||||
* <dd><code>DOMDocumentType</code> nodes cannot
|
||||
* be adopted.</dd>
|
||||
* <dt>ELEMENT_NODE</dt>
|
||||
* <dd>Specified attribute nodes of the source
|
||||
* element are adopted, and the generated <code>DOMAttr</code> nodes.
|
||||
* Default attributes are discarded, though if the document being
|
||||
* adopted into defines default attributes for this element name, those
|
||||
* are assigned. The descendants of the source element are recursively
|
||||
* adopted.</dd>
|
||||
* <dt>ENTITY_NODE</dt>
|
||||
* <dd><code>DOMEntity</code> nodes cannot be adopted.</dd>
|
||||
* <dt>
|
||||
* ENTITY_REFERENCE_NODE</dt>
|
||||
* <dd>Only the <code>DOMEntityReference</code> node
|
||||
* itself is adopted, the descendants are discarded, since the source
|
||||
* and destination documents might have defined the entity differently.
|
||||
* If the document being imported into provides a definition for this
|
||||
* entity name, its value is assigned.</dd>
|
||||
* <dt>NOTATION_NODE</dt>
|
||||
* <dd><code>DOMNotation</code>
|
||||
* nodes cannot be adopted.</dd>
|
||||
* <dt>PROCESSING_INSTRUCTION_NODE, TEXT_NODE,
|
||||
* CDATA_SECTION_NODE, COMMENT_NODE</dt>
|
||||
* <dd>These nodes can all be adopted. No
|
||||
* specifics.</dd>
|
||||
* </dl>
|
||||
* @param source The node to move into this document.
|
||||
* @return The adopted node, or <code>null</code> if this operation
|
||||
* fails, such as when the source node comes from a different
|
||||
* implementation.
|
||||
* @exception DOMException
|
||||
* NOT_SUPPORTED_ERR: Raised if the source node is of type
|
||||
* <code>DOCUMENT</code>, <code>DOCUMENT_TYPE</code>.
|
||||
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is
|
||||
* readonly.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMNode* adoptNode(DOMNode* source) = 0;
|
||||
|
||||
/**
|
||||
* This method acts as if the document was going through a save and load
|
||||
* cycle, putting the document in a "normal" form. The actual result
|
||||
* depends on the features being set. See <code>DOMConfiguration</code> for
|
||||
* details.
|
||||
*
|
||||
* <br>Noticeably this method normalizes <code>DOMText</code> nodes, makes
|
||||
* the document "namespace wellformed", according to the algorithm
|
||||
* described below in pseudo code, by adding missing namespace
|
||||
* declaration attributes and adding or changing namespace prefixes,
|
||||
* updates the replacement tree of <code>DOMEntityReference</code> nodes,
|
||||
* normalizes attribute values, etc.
|
||||
* <br>Mutation events, when supported, are generated to reflect the
|
||||
* changes occurring on the document.
|
||||
* Note that this is a partial implementation. Not all the required features are implemented.
|
||||
* Currently <code>DOMAttr</code> and <code>DOMText</code> nodes are normalized.
|
||||
* Features to remove <code>DOMComment</code> and <code>DOMCDATASection</code> work.
|
||||
* @since DOM Level 3
|
||||
*
|
||||
*/
|
||||
virtual void normalizeDocument() = 0;
|
||||
|
||||
|
||||
/**
|
||||
* The configuration used when DOMDocument::normalizeDocument is invoked.
|
||||
*
|
||||
* @return The <code>DOMConfiguration</code> from this <code>DOMDocument</code>
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMConfiguration* getDOMConfig() const = 0;
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard extension */
|
||||
//@{
|
||||
/**
|
||||
* Non-standard extension
|
||||
*
|
||||
* Create a new entity.
|
||||
* @param name The name of the entity to instantiate
|
||||
*
|
||||
*/
|
||||
virtual DOMEntity *createEntity(const XMLCh *name) = 0;
|
||||
|
||||
/**
|
||||
* Non-standard extension
|
||||
*
|
||||
* Create a DOMDocumentType node.
|
||||
* @return A <code>DOMDocumentType</code> that references the newly
|
||||
* created DOMDocumentType node.
|
||||
*
|
||||
*/
|
||||
virtual DOMDocumentType *createDocumentType(const XMLCh *name) = 0;
|
||||
|
||||
/***
|
||||
* Provide default implementation to maintain source code compatibility
|
||||
***/
|
||||
virtual DOMDocumentType* createDocumentType(const XMLCh *qName,
|
||||
const XMLCh*, //publicId,
|
||||
const XMLCh* //systemId
|
||||
)
|
||||
{
|
||||
return createDocumentType(qName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-standard extension.
|
||||
*
|
||||
* Create a Notation.
|
||||
* @param name The name of the notation to instantiate
|
||||
* @return A <code>DOMNotation</code> that references the newly
|
||||
* created DOMNotation node.
|
||||
*/
|
||||
virtual DOMNotation *createNotation(const XMLCh *name) = 0;
|
||||
|
||||
/**
|
||||
* Non-standard extension.
|
||||
*
|
||||
* Creates an element of the given qualified name and
|
||||
* namespace URI, and also stores line/column number info.
|
||||
* Used by internally XSDXercesDOMParser during schema traversal.
|
||||
*
|
||||
* @see createElementNS(const XMLCh *namespaceURI, const XMLCh *qualifiedName)
|
||||
*/
|
||||
virtual DOMElement *createElementNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *qualifiedName,
|
||||
const XMLFileLoc lineNum,
|
||||
const XMLFileLoc columnNum) = 0;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMDocumentFragment.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTFRAGMENT_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTFRAGMENT_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* DOMDocumentFragment is a "lightweight" or "minimal"
|
||||
* DOMDocument object.
|
||||
*
|
||||
* It is very common to want to be able to
|
||||
* extract a portion of a document's tree or to create a new fragment of a
|
||||
* document. Imagine implementing a user command like cut or rearranging a
|
||||
* document by moving fragments around. It is desirable to have an object
|
||||
* which can hold such fragments and it is quite natural to use a DOMNode for
|
||||
* this purpose. While it is true that a <code>DOMDocument</code> object could
|
||||
* fulfill this role, a <code>DOMDocument</code> object can potentially be a
|
||||
* heavyweight object, depending on the underlying implementation. What is
|
||||
* really needed for this is a very lightweight object.
|
||||
* <code>DOMDocumentFragment</code> is such an object.
|
||||
* <p>Furthermore, various operations -- such as inserting nodes as children
|
||||
* of another <code>DOMNode</code> -- may take <code>DOMDocumentFragment</code>
|
||||
* objects as arguments; this results in all the child nodes of the
|
||||
* <code>DOMDocumentFragment</code> being moved to the child list of this node.
|
||||
* <p>The children of a <code>DOMDocumentFragment</code> node are zero or more
|
||||
* nodes representing the tops of any sub-trees defining the structure of the
|
||||
* document. <code>DOMDocumentFragment</code> nodes do not need to be
|
||||
* well-formed XML documents (although they do need to follow the rules
|
||||
* imposed upon well-formed XML parsed entities, which can have multiple top
|
||||
* nodes). For example, a <code>DOMDocumentFragment</code> might have only one
|
||||
* child and that child node could be a <code>DOMText</code> node. Such a
|
||||
* structure model represents neither an HTML document nor a well-formed XML
|
||||
* document.
|
||||
* <p>When a <code>DOMDocumentFragment</code> is inserted into a
|
||||
* <code>DOMDocument</code> (or indeed any other <code>DOMNode</code> that may take
|
||||
* children) the children of the <code>DOMDocumentFragment</code> and not the
|
||||
* <code>DOMDocumentFragment</code> itself are inserted into the
|
||||
* <code>DOMNode</code>. This makes the <code>DOMDocumentFragment</code> very
|
||||
* useful when the user wishes to create nodes that are siblings; the
|
||||
* <code>DOMDocumentFragment</code> acts as the parent of these nodes so that the
|
||||
* user can use the standard methods from the <code>DOMNode</code> interface,
|
||||
* such as <code>insertBefore()</code> and <code>appendChild()</code>.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
|
||||
class CDOM_EXPORT DOMDocumentFragment: public DOMNode {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMDocumentFragment() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMDocumentFragment(const DOMDocumentFragment &);
|
||||
DOMDocumentFragment & operator = (const DOMDocumentFragment &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMDocumentFragment() {};
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMDocumentRange.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTRANGE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTRANGE_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMRange;
|
||||
|
||||
|
||||
/**
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
class CDOM_EXPORT DOMDocumentRange {
|
||||
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMDocumentRange() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMDocumentRange(const DOMDocumentRange &);
|
||||
DOMDocumentRange & operator = (const DOMDocumentRange &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMDocumentRange() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMDocumentRange interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 2 */
|
||||
//@{
|
||||
/**
|
||||
* To create the range consisting of boundary-points and offset of the
|
||||
* selected contents
|
||||
*
|
||||
* @return The initial state of the Range such that both the boundary-points
|
||||
* are positioned at the beginning of the corresponding DOMDOcument, before
|
||||
* any content. The range returned can only be used to select content
|
||||
* associated with this document, or with documentFragments and Attrs for
|
||||
* which this document is the ownerdocument
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMRange *createRange() = 0;
|
||||
|
||||
//@}
|
||||
};
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMDocumentTraversal.hpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTTRAVERSAL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTTRAVERSAL_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMNodeFilter.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMNode;
|
||||
class DOMNodeIterator;
|
||||
class DOMTreeWalker;
|
||||
|
||||
|
||||
/**
|
||||
* <code>DOMDocumentTraversal</code> contains methods that create
|
||||
* <code>DOMNodeIterators</code> and <code>DOMTreeWalkers</code> to traverse a
|
||||
* node and its children in document order (depth first, pre-order
|
||||
* traversal, which is equivalent to the order in which the start tags occur
|
||||
* in the text representation of the document). In DOMs which support the
|
||||
* Traversal feature, <code>DOMDocumentTraversal</code> will be implemented by
|
||||
* the same objects that implement the DOMDocument interface.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
class CDOM_EXPORT DOMDocumentTraversal {
|
||||
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMDocumentTraversal() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMDocumentTraversal(const DOMDocumentTraversal &);
|
||||
DOMDocumentTraversal & operator = (const DOMDocumentTraversal &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMDocumentTraversal() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMDocumentRange interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 2 */
|
||||
//@{
|
||||
/**
|
||||
* Creates a NodeIterator object. (DOM2)
|
||||
*
|
||||
* NodeIterators are used to step through a set of nodes, e.g. the set of nodes in a NodeList, the
|
||||
* document subtree governed by a particular node, the results of a query, or any other set of nodes.
|
||||
* The set of nodes to be iterated is determined by the implementation of the NodeIterator. DOM Level 2
|
||||
* specifies a single NodeIterator implementation for document-order traversal of a document subtree.
|
||||
* Instances of these iterators are created by calling <code>DOMDocumentTraversal.createNodeIterator()</code>.
|
||||
*
|
||||
* To produce a view of the document that has entity references expanded and does not
|
||||
* expose the entity reference node itself, use the <code>whatToShow</code> flags to hide the entity
|
||||
* reference node and set expandEntityReferences to true when creating the iterator. To
|
||||
* produce a view of the document that has entity reference nodes but no entity expansion,
|
||||
* use the <code>whatToShow</code> flags to show the entity reference node and set
|
||||
* expandEntityReferences to false.
|
||||
*
|
||||
* @param root The root node of the DOM tree
|
||||
* @param whatToShow This attribute determines which node types are presented via the iterator.
|
||||
* @param filter The filter used to screen nodes
|
||||
* @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are
|
||||
* visible to the iterator. If false, they will be skipped over.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
|
||||
virtual DOMNodeIterator *createNodeIterator(DOMNode* root,
|
||||
DOMNodeFilter::ShowType whatToShow,
|
||||
DOMNodeFilter* filter,
|
||||
bool entityReferenceExpansion) = 0;
|
||||
/**
|
||||
* Creates a TreeWalker object. (DOM2)
|
||||
*
|
||||
* TreeWalker objects are used to navigate a document tree or subtree using the view of the document defined
|
||||
* by its whatToShow flags and any filters that are defined for the TreeWalker. Any function which performs
|
||||
* navigation using a TreeWalker will automatically support any view defined by a TreeWalker.
|
||||
*
|
||||
* Omitting nodes from the logical view of a subtree can result in a structure that is substantially different from
|
||||
* the same subtree in the complete, unfiltered document. Nodes that are siblings in the TreeWalker view may
|
||||
* be children of different, widely separated nodes in the original view. For instance, consider a Filter that skips
|
||||
* all nodes except for DOMText nodes and the root node of a document. In the logical view that results, all text
|
||||
* nodes will be siblings and appear as direct children of the root node, no matter how deeply nested the
|
||||
* structure of the original document.
|
||||
*
|
||||
* To produce a view of the document that has entity references expanded
|
||||
* and does not expose the entity reference node itself, use the whatToShow
|
||||
* flags to hide the entity reference node and set <code>expandEntityReferences</code> to
|
||||
* true when creating the TreeWalker. To produce a view of the document
|
||||
* that has entity reference nodes but no entity expansion, use the
|
||||
* <code>whatToShow</code> flags to show the entity reference node and set
|
||||
* <code>expandEntityReferences</code> to false
|
||||
*
|
||||
* @param root The root node of the DOM tree
|
||||
* @param whatToShow This attribute determines which node types are presented via the tree-walker.
|
||||
* @param filter The filter used to screen nodes
|
||||
* @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are
|
||||
* visible to the tree-walker. If false, they will be skipped over.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
|
||||
virtual DOMTreeWalker *createTreeWalker(DOMNode* root,
|
||||
DOMNodeFilter::ShowType whatToShow,
|
||||
DOMNodeFilter* filter,
|
||||
bool entityReferenceExpansion) = 0;
|
||||
|
||||
//@}
|
||||
};
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMDocumentType.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTTYPE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTTYPE_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMNamedNodeMap;
|
||||
|
||||
/**
|
||||
* Each <code>DOMDocument</code> has a <code>doctype</code> attribute whose value
|
||||
* is either <code>null</code> or a <code>DOMDocumentType</code> object. The
|
||||
* <code>DOMDocumentType</code> interface in the DOM Core provides an interface
|
||||
* to the list of entities that are defined for the document, and little
|
||||
* else because the effect of namespaces and the various XML schema efforts
|
||||
* on DTD representation are not clearly understood as of this writing.
|
||||
* <p>The DOM Level 2 doesn't support editing <code>DOMDocumentType</code> nodes.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
class CDOM_EXPORT DOMDocumentType: public DOMNode {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMDocumentType() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMDocumentType(const DOMDocumentType &);
|
||||
DOMDocumentType & operator = (const DOMDocumentType &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMDocumentType() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMDocumentType interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 1 */
|
||||
//@{
|
||||
/**
|
||||
* The name of DTD; i.e., the name immediately following the
|
||||
* <code>DOCTYPE</code> keyword.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh * getName() const = 0;
|
||||
|
||||
/**
|
||||
* A <code>DOMNamedNodeMap</code> containing the general entities, both
|
||||
* external and internal, declared in the DTD. Parameter entities are
|
||||
* not contained. Duplicates are discarded. For example in:
|
||||
* <code><!DOCTYPE<br>
|
||||
* ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar<br>
|
||||
* "bar"> <!ENTITY bar "bar2"> <!ENTITY % baz "baz"><br>
|
||||
* ]> <ex/><br></code>
|
||||
* the interface provides access to <code>foo</code>
|
||||
* and the first declaration of <code>bar</code> but not the second
|
||||
* declaration of <code>bar</code> or <code>baz</code>. Every node in
|
||||
* this map also implements the <code>DOMEntity</code> interface.
|
||||
* <br>The DOM Level 2 does not support editing entities, therefore
|
||||
* <code>entities</code> cannot be altered in any way.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNamedNodeMap *getEntities() const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* A <code>DOMNamedNodeMap</code> containing the notations declared in the
|
||||
* DTD. Duplicates are discarded. Every node in this map also implements
|
||||
* the <code>DOMNotation</code> interface.
|
||||
* <br>The DOM Level 2 does not support editing notations, therefore
|
||||
* <code>notations</code> cannot be altered in any way.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNamedNodeMap *getNotations() const = 0;
|
||||
//@}
|
||||
|
||||
/** @name Functions introduced in DOM Level 2. */
|
||||
//@{
|
||||
/**
|
||||
* Get the public identifier of the external subset.
|
||||
*
|
||||
* @return The public identifier of the external subset.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual const XMLCh * getPublicId() const = 0;
|
||||
|
||||
/**
|
||||
* Get the system identifier of the external subset.
|
||||
*
|
||||
* @return The system identifier of the external subset.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual const XMLCh * getSystemId() const = 0;
|
||||
|
||||
/**
|
||||
* The internal subset as a string, or <code>null</code> if there is none.
|
||||
* This is does not contain the delimiting square brackets.The actual
|
||||
* content returned depends on how much information is available to the
|
||||
* implementation. This may vary depending on various parameters,
|
||||
* including the XML processor used to build the document.
|
||||
*
|
||||
* @return The internal subset as a string.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual const XMLCh * getInternalSubset() const = 0;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,528 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMElement.hpp 792236 2009-07-08 17:22:35Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMELEMENT_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMELEMENT_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMAttr;
|
||||
class DOMNodeList;
|
||||
class DOMTypeInfo;
|
||||
|
||||
|
||||
/**
|
||||
* By far the vast majority of objects (apart from text) that authors
|
||||
* encounter when traversing a document are <code>DOMElement</code> nodes.
|
||||
*
|
||||
* Assume the following XML document:<elementExample id="demo">
|
||||
* <subelement1/>
|
||||
* <subelement2><subsubelement/></subelement2>
|
||||
* </elementExample>
|
||||
* <p>When represented using DOM, the top node is an <code>DOMElement</code> node
|
||||
* for "elementExample", which contains two child <code>DOMElement</code> nodes,
|
||||
* one for "subelement1" and one for "subelement2". "subelement1" contains no
|
||||
* child nodes.
|
||||
* <p>Elements may have attributes associated with them; since the
|
||||
* <code>DOMElement</code> interface inherits from <code>DOMNode</code>, the generic
|
||||
* <code>DOMNode</code> interface method <code>getAttributes</code> may be used
|
||||
* to retrieve the set of all attributes for an element. There are methods on
|
||||
* the <code>DOMElement</code> interface to retrieve either an <code>DOMAttr</code>
|
||||
* object by name or an attribute value by name. In XML, where an attribute
|
||||
* value may contain entity references, an <code>DOMAttr</code> object should be
|
||||
* retrieved to examine the possibly fairly complex sub-tree representing the
|
||||
* attribute value. On the other hand, in HTML, where all attributes have
|
||||
* simple string values, methods to directly access an attribute value can
|
||||
* safely be used as a convenience.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*
|
||||
* It also defines the ElementTraversal helper interface defined by http://www.w3.org/TR/2008/REC-ElementTraversal-20081222/
|
||||
*
|
||||
*/
|
||||
|
||||
class CDOM_EXPORT DOMElement: public DOMNode {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMElement() {}
|
||||
DOMElement(const DOMElement &other) : DOMNode(other) {}
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented operators */
|
||||
//@{
|
||||
DOMElement & operator = (const DOMElement &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMElement() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMElement interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 1 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* The name of the element.
|
||||
*
|
||||
* For example, in: <elementExample
|
||||
* id="demo"> ... </elementExample> , <code>tagName</code> has
|
||||
* the value <code>"elementExample"</code>. Note that this is
|
||||
* case-preserving in XML, as are all of the operations of the DOM.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh * getTagName() const = 0;
|
||||
|
||||
/**
|
||||
* Retrieves an attribute value by name.
|
||||
*
|
||||
* @param name The name of the attribute to retrieve.
|
||||
* @return The <code>DOMAttr</code> value as a string, or the empty string if
|
||||
* that attribute does not have a specified or default value.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh * getAttribute(const XMLCh *name) const = 0;
|
||||
|
||||
/**
|
||||
* Retrieves an <code>DOMAttr</code> node by name.
|
||||
*
|
||||
* @param name The name (<CODE>nodeName</CODE>) of the attribute to retrieve.
|
||||
* @return The <code>DOMAttr</code> node with the specified name (<CODE>nodeName</CODE>) or
|
||||
* <code>null</code> if there is no such attribute.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMAttr * getAttributeNode(const XMLCh *name) const = 0;
|
||||
|
||||
/**
|
||||
* Returns a <code>DOMNodeList</code> of all descendant elements with a given
|
||||
* tag name, in the order in which they would be encountered in a preorder
|
||||
* traversal of the <code>DOMElement</code> tree.
|
||||
*
|
||||
* @param name The name of the tag to match on. The special value "*"
|
||||
* matches all tags.
|
||||
* @return A list of matching <code>DOMElement</code> nodes.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNodeList * getElementsByTagName(const XMLCh *name) const = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Adds a new attribute.
|
||||
*
|
||||
* If an attribute with that name is already present
|
||||
* in the element, its value is changed to be that of the value parameter.
|
||||
* This value is a simple string, it is not parsed as it is being set. So
|
||||
* any markup (such as syntax to be recognized as an entity reference) is
|
||||
* treated as literal text, and needs to be appropriately escaped by the
|
||||
* implementation when it is written out. In order to assign an attribute
|
||||
* value that contains entity references, the user must create an
|
||||
* <code>DOMAttr</code> node plus any <code>DOMText</code> and
|
||||
* <code>DOMEntityReference</code> nodes, build the appropriate subtree, and
|
||||
* use <code>setAttributeNode</code> to assign it as the value of an
|
||||
* attribute.
|
||||
* @param name The name of the attribute to create or alter.
|
||||
* @param value Value to set in string form.
|
||||
* @exception DOMException
|
||||
* INVALID_CHARACTER_ERR: Raised if the specified name contains an
|
||||
* illegal character.
|
||||
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual void setAttribute(const XMLCh *name,
|
||||
const XMLCh *value) = 0;
|
||||
/**
|
||||
* Adds a new attribute.
|
||||
*
|
||||
* If an attribute with that name (<CODE>nodeName</CODE>) is already present
|
||||
* in the element, it is replaced by the new one.
|
||||
* @param newAttr The <code>DOMAttr</code> node to add to the attribute list.
|
||||
* @return If the <code>newAttr</code> attribute replaces an existing
|
||||
* attribute, the replaced
|
||||
* <code>DOMAttr</code> node is returned, otherwise <code>null</code> is
|
||||
* returned.
|
||||
* @exception DOMException
|
||||
* WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a
|
||||
* different document than the one that created the element.
|
||||
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
|
||||
* <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an
|
||||
* attribute of another <code>DOMElement</code> object. The DOM user must
|
||||
* explicitly clone <code>DOMAttr</code> nodes to re-use them in other
|
||||
* elements.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMAttr * setAttributeNode(DOMAttr *newAttr) = 0;
|
||||
|
||||
/**
|
||||
* Removes the specified attribute node.
|
||||
* If the removed <CODE>DOMAttr</CODE>
|
||||
* has a default value it is immediately replaced. The replacing attribute
|
||||
* has the same namespace URI and local name, as well as the original prefix,
|
||||
* when applicable.
|
||||
*
|
||||
* @param oldAttr The <code>DOMAttr</code> node to remove from the attribute
|
||||
* list.
|
||||
* @return The <code>DOMAttr</code> node that was removed.
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
|
||||
* <br>NOT_FOUND_ERR: Raised if <code>oldAttr</code> is not an attribute
|
||||
* of the element.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMAttr * removeAttributeNode(DOMAttr *oldAttr) = 0;
|
||||
|
||||
/**
|
||||
* Removes an attribute by name.
|
||||
*
|
||||
* If the removed attribute
|
||||
* is known to have a default value, an attribute immediately appears
|
||||
* containing the default value as well as the corresponding namespace URI,
|
||||
* local name, and prefix when applicable.<BR>To remove an attribute by local
|
||||
* name and namespace URI, use the <CODE>removeAttributeNS</CODE> method.
|
||||
* @param name The name of the attribute to remove.
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual void removeAttribute(const XMLCh *name) = 0;
|
||||
//@}
|
||||
|
||||
/** @name Functions introduced in DOM Level 2. */
|
||||
//@{
|
||||
/**
|
||||
* Retrieves an attribute value by local name and namespace URI.
|
||||
*
|
||||
* @param namespaceURI The <em>namespace URI</em> of
|
||||
* the attribute to retrieve.
|
||||
* @param localName The <em>local name</em> of the
|
||||
* attribute to retrieve.
|
||||
* @return The <code>DOMAttr</code> value as a string, or an <CODE>null</CODE> if
|
||||
* that attribute does not have a specified or default value.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual const XMLCh * getAttributeNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const = 0;
|
||||
|
||||
/**
|
||||
* Adds a new attribute. If an attribute with the same
|
||||
* local name and namespace URI is already present on the element, its prefix
|
||||
* is changed to be the prefix part of the <CODE>qualifiedName</CODE>, and
|
||||
* its value is changed to be the <CODE>value</CODE> parameter. This value is
|
||||
* a simple string, it is not parsed as it is being set. So any markup (such
|
||||
* as syntax to be recognized as an entity reference) is treated as literal
|
||||
* text, and needs to be appropriately escaped by the implementation when it
|
||||
* is written out. In order to assign an attribute value that contains entity
|
||||
* references, the user must create an <CODE>DOMAttr</CODE>
|
||||
* node plus any <CODE>DOMText</CODE> and <CODE>DOMEntityReference</CODE>
|
||||
* nodes, build the appropriate subtree, and use
|
||||
* <CODE>setAttributeNodeNS</CODE> or <CODE>setAttributeNode</CODE> to assign
|
||||
* it as the value of an attribute.
|
||||
*
|
||||
* @param namespaceURI The <em>namespace URI</em> of
|
||||
* the attribute to create or alter.
|
||||
* @param qualifiedName The <em>qualified name</em> of the
|
||||
* attribute to create or alter.
|
||||
* @param value The value to set in string form.
|
||||
* @exception DOMException
|
||||
* INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an
|
||||
* illegal character.
|
||||
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
|
||||
* <br>
|
||||
* NAMESPACE_ERR: Raised if the <CODE>qualifiedName</CODE> is
|
||||
* malformed, if the <CODE>qualifiedName</CODE> has a prefix and the
|
||||
* <CODE>namespaceURI</CODE> is <CODE>null</CODE> or an empty string,
|
||||
* if the <CODE>qualifiedName</CODE> has a prefix that is "xml" and the
|
||||
* <CODE>namespaceURI</CODE> is different from
|
||||
* "http://www.w3.org/XML/1998/namespace", if the
|
||||
* <CODE>qualifiedName</CODE> has a prefix that is "xmlns" and the
|
||||
* <CODE>namespaceURI</CODE> is different from
|
||||
* "http://www.w3.org/2000/xmlns/", or if the
|
||||
* <CODE>qualifiedName</CODE> is "xmlns" and the
|
||||
* <CODE>namespaceURI</CODE> is different from
|
||||
* "http://www.w3.org/2000/xmlns/".
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void setAttributeNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *qualifiedName, const XMLCh *value) = 0;
|
||||
|
||||
/**
|
||||
* Removes an attribute by local name and namespace URI. If the
|
||||
* removed attribute has a default value it is immediately replaced.
|
||||
* The replacing attribute has the same namespace URI and local name, as well as
|
||||
* the original prefix.
|
||||
*
|
||||
* @param namespaceURI The <em>namespace URI</em> of
|
||||
* the attribute to remove.
|
||||
* @param localName The <em>local name</em> of the
|
||||
* attribute to remove.
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void removeAttributeNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) = 0;
|
||||
|
||||
/**
|
||||
* Retrieves an <code>DOMAttr</code> node by local name and namespace URI.
|
||||
*
|
||||
* @param namespaceURI The <em>namespace URI</em> of
|
||||
* the attribute to retrieve.
|
||||
* @param localName The <em>local name</em> of the
|
||||
* attribute to retrieve.
|
||||
* @return The <code>DOMAttr</code> node with the specified attribute local
|
||||
* name and namespace URI or <code>null</code> if there is no such attribute.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMAttr * getAttributeNodeNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const = 0;
|
||||
|
||||
/**
|
||||
* Adds a new attribute.
|
||||
*
|
||||
* If an attribute with that local name and namespace URI is already present
|
||||
* in the element, it is replaced by the new one.
|
||||
*
|
||||
* @param newAttr The <code>DOMAttr</code> node to add to the attribute list.
|
||||
* @return If the <code>newAttr</code> attribute replaces an existing
|
||||
* attribute with the same <em>local name</em> and <em>namespace URI</em>,
|
||||
* the replaced <code>DOMAttr</code> node is
|
||||
* returned, otherwise <code>null</code> is returned.
|
||||
* @exception DOMException
|
||||
* WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a
|
||||
* different document than the one that created the element.
|
||||
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
|
||||
* <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an
|
||||
* attribute of another <code>DOMElement</code> object. The DOM user must
|
||||
* explicitly clone <code>DOMAttr</code> nodes to re-use them in other
|
||||
* elements.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMAttr * setAttributeNodeNS(DOMAttr *newAttr) = 0;
|
||||
|
||||
/**
|
||||
* Returns a <code>DOMNodeList</code> of all the <code>DOMElement</code>s
|
||||
* with a given local name and namespace URI in the order in which they
|
||||
* would be encountered in a preorder traversal of the
|
||||
* <code>DOMDocument</code> tree, starting from this node.
|
||||
*
|
||||
* @param namespaceURI The <em>namespace URI</em> of
|
||||
* the elements to match on. The special value "*" matches all
|
||||
* namespaces.
|
||||
* @param localName The <em>local name</em> of the
|
||||
* elements to match on. The special value "*" matches all local names.
|
||||
* @return A new <code>DOMNodeList</code> object containing all the matched
|
||||
* <code>DOMElement</code>s.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNodeList * getElementsByTagNameNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const = 0;
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> when an attribute with a given name is
|
||||
* specified on this element or has a default value, <code>false</code>
|
||||
* otherwise.
|
||||
* @param name The name of the attribute to look for.
|
||||
* @return <code>true</code> if an attribute with the given name is
|
||||
* specified on this element or has a default value, <code>false</code>
|
||||
* otherwise.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual bool hasAttribute(const XMLCh *name) const = 0;
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> when an attribute with a given local name and
|
||||
* namespace URI is specified on this element or has a default value,
|
||||
* <code>false</code> otherwise. HTML-only DOM implementations do not
|
||||
* need to implement this method.
|
||||
* @param namespaceURI The namespace URI of the attribute to look for.
|
||||
* @param localName The local name of the attribute to look for.
|
||||
* @return <code>true</code> if an attribute with the given local name
|
||||
* and namespace URI is specified or has a default value on this
|
||||
* element, <code>false</code> otherwise.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual bool hasAttributeNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const = 0;
|
||||
//@}
|
||||
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* If the parameter isId is <code>true</code>, this method declares the specified
|
||||
* attribute to be a user-determined ID attribute.
|
||||
* This affects the value of <code>DOMAttr::isId</code> and the behavior of
|
||||
* <code>DOMDocument::getElementById</code>, but does not change any schema that
|
||||
* may be in use, in particular this does not affect the <code>DOMAttr::getSchemaTypeInfo</code>
|
||||
* of the specified DOMAttr node. Use the value <code>false</code> for the parameter isId
|
||||
* to undeclare an attribute for being a user-determined ID attribute.
|
||||
* To specify an <code>DOMAttr</code> by local name and namespace URI, use the
|
||||
* setIdAttributeNS method.
|
||||
*
|
||||
* @param name The name of the <code>DOMAttr</code>.
|
||||
* @param isId Whether the attribute is of type ID.
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.<br>
|
||||
* NOT_FOUND_ERR: Raised if the specified node is not an <code>DOMAttr</code>
|
||||
* of this element.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setIdAttribute(const XMLCh* name, bool isId) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* If the parameter isId is <code>true</code>, this method declares the specified
|
||||
* attribute to be a user-determined ID attribute.
|
||||
* This affects the value of <code>DOMAttr::isId</code> and the behavior of
|
||||
* <code>DOMDocument::getElementById</code>, but does not change any schema that
|
||||
* may be in use, in particular this does not affect the <code>DOMAttr::getSchemaTypeInfo</code>
|
||||
* of the specified DOMAttr node. Use the value <code>false</code> for the parameter isId
|
||||
* to undeclare an attribute for being a user-determined ID attribute.
|
||||
*
|
||||
* @param namespaceURI The namespace URI of the <code>DOMAttr</code>.
|
||||
* @param localName The local name of the <code>DOMAttr</code>.
|
||||
* @param isId Whether the attribute is of type ID.
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.<br>
|
||||
* NOT_FOUND_ERR: Raised if the specified node is not an <code>DOMAttr</code> of this element.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setIdAttributeNS(const XMLCh* namespaceURI, const XMLCh* localName, bool isId) = 0;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* If the parameter isId is <code>true</code>, this method declares the specified
|
||||
* attribute to be a user-determined ID attribute.
|
||||
* This affects the value of <code>DOMAttr::isId</code> and the behavior of
|
||||
* <code>DOMDocument::getElementById</code>, but does not change any schema that
|
||||
* may be in use, in particular this does not affect the <code>DOMAttr::getSchemaTypeInfo</code>
|
||||
* of the specified DOMAttr node. Use the value <code>false</code> for the parameter isId
|
||||
* to undeclare an attribute for being a user-determined ID attribute.
|
||||
*
|
||||
* @param idAttr The <code>DOMAttr</code> node.
|
||||
* @param isId Whether the attribute is of type ID.
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.<br>
|
||||
* NOT_FOUND_ERR: Raised if the specified node is not an <code>DOMAttr</code> of this element.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setIdAttributeNode(const DOMAttr *idAttr, bool isId) = 0;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the type information associated with this element.
|
||||
*
|
||||
* @return the <code>DOMTypeInfo</code> associated with this element
|
||||
* @since DOM level 3
|
||||
*/
|
||||
virtual const DOMTypeInfo* getSchemaTypeInfo() const = 0;
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// DOMElementTraversal interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in the ElementTraversal specification (http://www.w3.org/TR/2008/REC-ElementTraversal-20081222/)*/
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* The first child of type DOMElement.
|
||||
*
|
||||
* @return The <code>DOMElement</code> object that is the first element node
|
||||
* among the child nodes of this node, or <code>null</code> if there is none.
|
||||
*/
|
||||
virtual DOMElement * getFirstElementChild() const = 0;
|
||||
|
||||
/**
|
||||
* The last child of type DOMElement.
|
||||
*
|
||||
* @return The <code>DOMElement</code> object that is the last element node
|
||||
* among the child nodes of this node, or <code>null</code> if there is none.
|
||||
*/
|
||||
virtual DOMElement * getLastElementChild() const = 0;
|
||||
|
||||
/**
|
||||
* The previous sibling node of type DOMElement.
|
||||
*
|
||||
* @return The <code>DOMElement</code> object that is the previous sibling element node
|
||||
* in document order, or <code>null</code> if there is none.
|
||||
*/
|
||||
virtual DOMElement * getPreviousElementSibling() const = 0;
|
||||
|
||||
/**
|
||||
* The next sibling node of type DOMElement.
|
||||
*
|
||||
* @return The <code>DOMElement</code> object that is the next sibling element node
|
||||
* in document order, or <code>null</code> if there is none.
|
||||
*/
|
||||
virtual DOMElement * getNextElementSibling() const = 0;
|
||||
|
||||
/**
|
||||
* The number of child nodes that are of type DOMElement.
|
||||
*
|
||||
* Note: the count is computed every time this function is invoked
|
||||
*
|
||||
* @return The number of <code>DOMElement</code> objects that are direct children
|
||||
* of this object (nested elements are not counted), or <code>0</code> if there is none.
|
||||
*
|
||||
*/
|
||||
virtual XMLSize_t getChildElementCount() const = 0;
|
||||
//@}
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMEntity.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMENTITY_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMENTITY_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This interface represents an entity, either parsed or unparsed, in an XML
|
||||
* document. Note that this models the entity itself not the entity
|
||||
* declaration. <code>DOMEntity</code> declaration modeling has been left for a
|
||||
* later Level of the DOM specification.
|
||||
* <p>The <code>nodeName</code> attribute that is inherited from
|
||||
* <code>DOMNode</code> contains the name of the entity.
|
||||
* <p>An XML processor may choose to completely expand entities before the
|
||||
* structure model is passed to the DOM; in this case there will be no
|
||||
* <code>DOMEntityReference</code> nodes in the document tree.
|
||||
* <p>XML does not mandate that a non-validating XML processor read and
|
||||
* process entity declarations made in the external subset or declared in
|
||||
* external parameter entities. This means that parsed entities declared in
|
||||
* the external subset need not be expanded by some classes of applications,
|
||||
* and that the replacement value of the entity may not be available. When
|
||||
* the replacement value is available, the corresponding <code>DOMEntity</code>
|
||||
* node's child list represents the structure of that replacement text.
|
||||
* Otherwise, the child list is empty.
|
||||
* <p>The DOM Level 2 does not support editing <code>DOMEntity</code> nodes; if a
|
||||
* user wants to make changes to the contents of an <code>DOMEntity</code>,
|
||||
* every related <code>DOMEntityReference</code> node has to be replaced in the
|
||||
* structure model by a clone of the <code>DOMEntity</code>'s contents, and
|
||||
* then the desired changes must be made to each of those clones instead.
|
||||
* <code>DOMEntity</code> nodes and all their descendants are readonly.
|
||||
* <p>An <code>DOMEntity</code> node does not have any parent.If the entity
|
||||
* contains an unbound namespace prefix, the <code>namespaceURI</code> of
|
||||
* the corresponding node in the <code>DOMEntity</code> node subtree is
|
||||
* <code>null</code>. The same is true for <code>DOMEntityReference</code>
|
||||
* nodes that refer to this entity, when they are created using the
|
||||
* <code>createEntityReference</code> method of the <code>DOMDocument</code>
|
||||
* interface. The DOM Level 2 does not support any mechanism to resolve
|
||||
* namespace prefixes.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
class CDOM_EXPORT DOMEntity: public DOMNode {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMEntity() {}
|
||||
DOMEntity(const DOMEntity &other) : DOMNode(other) {}
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented operators */
|
||||
//@{
|
||||
DOMEntity & operator = (const DOMEntity &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMEntity() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMEntity interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 1 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* The public identifier associated with the entity, if specified.
|
||||
*
|
||||
* If the public identifier was not specified, this is <code>null</code>.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh * getPublicId() const = 0;
|
||||
|
||||
/**
|
||||
* The system identifier associated with the entity, if specified.
|
||||
*
|
||||
* If the system identifier was not specified, this is <code>null</code>.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh * getSystemId() const = 0;
|
||||
|
||||
/**
|
||||
* For unparsed entities, the name of the notation for the entity.
|
||||
*
|
||||
* For parsed entities, this is <code>null</code>.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh * getNotationName() const = 0;
|
||||
//@}
|
||||
|
||||
/** @name Functions introduced in DOM Level 3. */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* An attribute specifying the encoding used for this entity at the time of parsing,
|
||||
* when it is an external parsed entity. This is <code>null</code> if it an entity
|
||||
* from the internal subset or if it is not known.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getInputEncoding() const = 0;
|
||||
|
||||
/**
|
||||
* An attribute specifying, as part of the text declaration, the encoding
|
||||
* of this entity, when it is an external parsed entity. This is
|
||||
* <code>null</code> otherwise.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getXmlEncoding() const = 0;
|
||||
|
||||
/**
|
||||
* An attribute specifying, as part of the text declaration, the version
|
||||
* number of this entity, when it is an external parsed entity. This is
|
||||
* <code>null</code> otherwise.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getXmlVersion() const = 0;
|
||||
//@}
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMEntityReference.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMENTITYREFERENCE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMENTITYREFERENCE_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* <code>DOMEntityReference</code> objects may be inserted into the structure
|
||||
* model when an entity reference is in the source document, or when the
|
||||
* user wishes to insert an entity reference. Note that character references
|
||||
* and references to predefined entities are considered to be expanded by
|
||||
* the HTML or XML processor so that characters are represented by their
|
||||
* Unicode equivalent rather than by an entity reference. Moreover, the XML
|
||||
* processor may completely expand references to entities while building the
|
||||
* structure model, instead of providing <code>DOMEntityReference</code>
|
||||
* objects. If it does provide such objects, then for a given
|
||||
* <code>DOMEntityReference</code> node, it may be that there is no
|
||||
* <code>DOMEntity</code> node representing the referenced entity. If such an
|
||||
* <code>DOMEntity</code> exists, then the subtree of the
|
||||
* <code>DOMEntityReference</code> node is in general a copy of the
|
||||
* <code>DOMEntity</code> node subtree. However, this may not be true when an
|
||||
* entity contains an unbound namespace prefix. In such a case, because the
|
||||
* namespace prefix resolution depends on where the entity reference is, the
|
||||
* descendants of the <code>DOMEntityReference</code> node may be bound to
|
||||
* different namespace URIs.
|
||||
* <p>As for <code>DOMEntity</code> nodes, <code>DOMEntityReference</code> nodes and
|
||||
* all their descendants are readonly.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
|
||||
class CDOM_EXPORT DOMEntityReference: public DOMNode {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMEntityReference() {}
|
||||
DOMEntityReference(const DOMEntityReference &other) : DOMNode(other) {}
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented operators */
|
||||
//@{
|
||||
DOMEntityReference & operator = (const DOMEntityReference &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMEntityReference() {};
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMError.hpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMERROR_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMERROR_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMLocator;
|
||||
|
||||
|
||||
/**
|
||||
* DOMError is an interface that describes an error.
|
||||
*
|
||||
* @see DOMErrorHandler#handleError
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
|
||||
class CDOM_EXPORT DOMError
|
||||
{
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMError() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMError(const DOMError &);
|
||||
DOMError & operator = (const DOMError &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMError() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Class types
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Public constants */
|
||||
//@{
|
||||
/**
|
||||
* The severity of the error described by the <code>DOMError</code>.
|
||||
*
|
||||
* <p><code>DOM_SEVERITY_ERROR:</code>
|
||||
* The severity of the error described by the <code>DOMError</code> is error.
|
||||
* A DOM_SEVERITY_ERROR may not cause the processing to stop if the error can
|
||||
* be recovered, unless <code>DOMErrorHandler::handleError()</code> returns false.</p>
|
||||
*
|
||||
* <p><code>DOM_SEVERITY_FATAL_ERROR</code>
|
||||
* The severity of the error described by the <code>DOMError</code> is fatal error.
|
||||
* A DOM_SEVERITY_FATAL_ERROR will cause the normal processing to stop. The return
|
||||
* value of <code>DOMErrorHandler::handleError()</code> is ignored unless the
|
||||
* implementation chooses to continue, in which case the behavior becomes undefined.</p>
|
||||
*
|
||||
* <p><code>DOM_SEVERITY_WARNING</code>
|
||||
* The severity of the error described by the <code>DOMError</code> is warning.
|
||||
* A DOM_SEVERITY_WARNING will not cause the processing to stop, unless
|
||||
* <code>DOMErrorHandler::handleError()</code> returns false.</p>
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
enum ErrorSeverity
|
||||
{
|
||||
DOM_SEVERITY_WARNING = 1,
|
||||
DOM_SEVERITY_ERROR = 2,
|
||||
DOM_SEVERITY_FATAL_ERROR = 3
|
||||
};
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMError interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Get the severity of the error
|
||||
*
|
||||
* @see setSeverity
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual ErrorSeverity getSeverity() const = 0;
|
||||
|
||||
/**
|
||||
* Get the message describing the error that occured.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getMessage() const = 0;
|
||||
|
||||
/**
|
||||
* Get the location of the error
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMLocator* getLocation() const = 0;
|
||||
|
||||
/**
|
||||
* The related platform dependent exception if any.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void* getRelatedException() const = 0;
|
||||
|
||||
/**
|
||||
* A <code>XMLCh*</code> indicating which related data is expected in
|
||||
* relatedData. Users should refer to the specification of the error
|
||||
* in order to find its <code>XMLCh*</code> type and relatedData
|
||||
* definitions if any.
|
||||
*
|
||||
* Note: As an example, <code>DOMDocument::normalizeDocument()</code> does generate
|
||||
* warnings when the "split-cdata-sections" parameter is in use. Therefore, the
|
||||
* method generates a DOM_SEVERITY_WARNING with type "cdata-sections-splitted"
|
||||
* and the first <code>DOMCDATASection</code> node in document order resulting from the split
|
||||
* is returned by the relatedData attribute.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getType() const = 0;
|
||||
|
||||
/**
|
||||
* The related DOMError::getType dependent data if any.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void* getRelatedData() const = 0;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMErrorHandler.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMERRORHANDLER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMERRORHANDLER_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMError;
|
||||
|
||||
/**
|
||||
* Basic interface for DOM error handlers.
|
||||
*
|
||||
* <p>DOMErrorHandler is a callback interface that the DOM implementation
|
||||
* can call when reporting errors that happens while processing XML data, or
|
||||
* when doing some other processing (e.g. validating a document).</p>
|
||||
*
|
||||
* <p>The application that is using the DOM implementation is expected to
|
||||
* implement this interface.</p>
|
||||
*
|
||||
* @see DOMLSParser#getDomConfig
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
|
||||
class CDOM_EXPORT DOMErrorHandler
|
||||
{
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMErrorHandler() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMErrorHandler(const DOMErrorHandler &);
|
||||
DOMErrorHandler & operator = (const DOMErrorHandler &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMErrorHandler() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMErrorHandler interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
/**
|
||||
* This method is called on the error handler when an error occurs.
|
||||
* If an exception is thrown from this method, it is considered to be equivalent of returning <code>true</code>.
|
||||
*
|
||||
* @param domError The error object that describes the error, this object
|
||||
* may be reused by the DOM implementation across multiple
|
||||
* calls to the handleError method.
|
||||
* @return If the handleError method returns <code>true</code> the DOM
|
||||
* implementation should continue as if the error didn't happen
|
||||
* when possible, if the method returns <code>false</code> then the
|
||||
* DOM implementation should stop the current processing when
|
||||
* possible.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual bool handleError(const DOMError& domError) = 0;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMException.cpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#include <xercesc/dom/DOMImplementation.hpp>
|
||||
#include <xercesc/framework/MemoryManager.hpp>
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
#include <xercesc/util/XMLMsgLoader.hpp>
|
||||
#include <xercesc/util/XMLDOMMsg.hpp>
|
||||
#include "impl/DOMImplementationImpl.hpp"
|
||||
|
||||
#include "DOMException.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Destructor and Constructor
|
||||
// ---------------------------------------------------------------------------
|
||||
DOMException::~DOMException()
|
||||
{
|
||||
if (msg && fMsgOwned)
|
||||
fMemoryManager->deallocate((void*)msg);
|
||||
}
|
||||
|
||||
DOMException::DOMException()
|
||||
:code(0)
|
||||
,msg(0)
|
||||
,fMemoryManager(0)
|
||||
,fMsgOwned(false)
|
||||
{
|
||||
}
|
||||
|
||||
DOMException::DOMException(short exCode,
|
||||
short messageCode,
|
||||
MemoryManager* const memoryManager)
|
||||
:code(exCode)
|
||||
,fMemoryManager(0)
|
||||
,fMsgOwned(true)
|
||||
{
|
||||
if (memoryManager)
|
||||
fMemoryManager = memoryManager->getExceptionMemoryManager();
|
||||
|
||||
const XMLSize_t msgSize = 2047;
|
||||
XMLCh errText[msgSize + 1];
|
||||
|
||||
// load the text
|
||||
if(messageCode==0)
|
||||
messageCode=XMLDOMMsg::DOMEXCEPTION_ERRX+exCode;
|
||||
|
||||
msg = XMLString::replicate
|
||||
(
|
||||
DOMImplementationImpl::getMsgLoader4DOM()->loadMsg(messageCode, errText, msgSize) ? errText : XMLUni::fgDefErrMsg
|
||||
, fMemoryManager
|
||||
);
|
||||
}
|
||||
|
||||
DOMException::DOMException(const DOMException &other)
|
||||
:code(other.code)
|
||||
,msg(0)
|
||||
,fMemoryManager(other.fMemoryManager)
|
||||
,fMsgOwned(other.fMsgOwned)
|
||||
{
|
||||
if (other.msg)
|
||||
msg = other.fMsgOwned? XMLString::replicate(other.msg, other.fMemoryManager) : other.msg;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,257 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMException.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMEXCEPTION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMEXCEPTION_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* DOM operations only raise exceptions in "exceptional" circumstances, i.e.,
|
||||
* when an operation is impossible to perform (either for logical reasons,
|
||||
* because data is lost, or because the implementation has become unstable).
|
||||
* In general, DOM methods return specific error values in ordinary
|
||||
* processing situations, such as out-of-bound errors when using
|
||||
* <code>DOMNodeList</code>.
|
||||
* <p>Implementations should raise other exceptions under other circumstances.
|
||||
* For example, implementations should raise an implementation-dependent
|
||||
* exception if a <code>null</code> argument is passed.
|
||||
* <p>Some languages and object systems do not support the concept of
|
||||
* exceptions. For such systems, error conditions may be indicated using
|
||||
* native error reporting mechanisms. For some bindings, for example,
|
||||
* methods may return error codes similar to those listed in the
|
||||
* corresponding method descriptions.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
|
||||
class MemoryManager;
|
||||
|
||||
class CDOM_EXPORT DOMException {
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Class Types
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Public Constants */
|
||||
//@{
|
||||
/**
|
||||
* ExceptionCode
|
||||
*
|
||||
* <p><code>INDEX_SIZE_ERR:</code>
|
||||
* If index or size is negative, or greater than the allowed value.</p>
|
||||
*
|
||||
* <p><code>DOMSTRING_SIZE_ERR:</code>
|
||||
* If the specified range of text does not fit into a DOMString.</p>
|
||||
*
|
||||
* <p><code>HIERARCHY_REQUEST_ERR:</code>
|
||||
* If any node is inserted somewhere it doesn't belong.</p>
|
||||
*
|
||||
* <p><code>WRONG_DOCUMENT_ERR:</code>
|
||||
* If a node is used in a different document than the one that created it
|
||||
* (that doesn't support it).</p>
|
||||
*
|
||||
* <p><code>INVALID_CHARACTER_ERR:</code>
|
||||
* If an invalid or illegal character is specified, such as in a name. See
|
||||
* production 2 in the XML specification for the definition of a legal
|
||||
* character, and production 5 for the definition of a legal name
|
||||
* character.</p>
|
||||
*
|
||||
* <p><code>NO_DATA_ALLOWED_ERR:</code>
|
||||
* If data is specified for a node which does not support data.</p>
|
||||
*
|
||||
* <p><code>NO_MODIFICATION_ALLOWED_ERR:</code>
|
||||
* If an attempt is made to modify an object where modifications are not
|
||||
* allowed.</p>
|
||||
*
|
||||
* <p><code>NOT_FOUND_ERR:</code>
|
||||
* If an attempt is made to reference a node in a context where it does
|
||||
* not exist.</p>
|
||||
*
|
||||
* <p><code>NOT_SUPPORTED_ERR:</code>
|
||||
* If the implementation does not support the requested type of object or
|
||||
* operation.</p>
|
||||
*
|
||||
* <p><code>INUSE_ATTRIBUTE_ERR:</code>
|
||||
* If an attempt is made to add an attribute that is already in use
|
||||
* elsewhere.</p>
|
||||
*
|
||||
* The above are since DOM Level 1
|
||||
* @since DOM Level 1
|
||||
*
|
||||
* <p><code>INVALID_STATE_ERR:</code>
|
||||
* If an attempt is made to use an object that is not, or is no longer,
|
||||
* usable.</p>
|
||||
*
|
||||
* <p><code>SYNTAX_ERR:</code>
|
||||
* If an invalid or illegal string is specified.</p>
|
||||
*
|
||||
* <p><code>INVALID_MODIFICATION_ERR:</code>
|
||||
* If an attempt is made to modify the type of the underlying object.</p>
|
||||
*
|
||||
* <p><code>NAMESPACE_ERR:</code>
|
||||
* If an attempt is made to create or change an object in a way which is
|
||||
* incorrect with regard to namespaces.</p>
|
||||
*
|
||||
* <p><code>INVALID_ACCESS_ERR:</code>
|
||||
* If a parameter or an operation is not supported by the underlying
|
||||
* object.
|
||||
*
|
||||
* The above are since DOM Level 2
|
||||
* @since DOM Level 2
|
||||
*
|
||||
* <p><code>VALIDATION_ERR:</code>
|
||||
* If a call to a method such as <code>insertBefore</code> or
|
||||
* <code>removeChild</code> would make the <code>Node</code> invalid
|
||||
* with respect to "partial validity", this exception would be raised
|
||||
* and the operation would not be done.
|
||||
*
|
||||
* <p><code>TYPE_MISMATCH_ERR:</code>
|
||||
* If the type of an object is incompatible with the expected type of
|
||||
* the parameter associated to the object, this exception would be raised.
|
||||
*
|
||||
* The above is since DOM Level 3
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
enum ExceptionCode {
|
||||
INDEX_SIZE_ERR = 1,
|
||||
DOMSTRING_SIZE_ERR = 2,
|
||||
HIERARCHY_REQUEST_ERR = 3,
|
||||
WRONG_DOCUMENT_ERR = 4,
|
||||
INVALID_CHARACTER_ERR = 5,
|
||||
NO_DATA_ALLOWED_ERR = 6,
|
||||
NO_MODIFICATION_ALLOWED_ERR = 7,
|
||||
NOT_FOUND_ERR = 8,
|
||||
NOT_SUPPORTED_ERR = 9,
|
||||
INUSE_ATTRIBUTE_ERR = 10,
|
||||
INVALID_STATE_ERR = 11,
|
||||
SYNTAX_ERR = 12,
|
||||
INVALID_MODIFICATION_ERR = 13,
|
||||
NAMESPACE_ERR = 14,
|
||||
INVALID_ACCESS_ERR = 15,
|
||||
VALIDATION_ERR = 16,
|
||||
TYPE_MISMATCH_ERR = 17
|
||||
};
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
/**
|
||||
* Default constructor for DOMException.
|
||||
*
|
||||
*/
|
||||
DOMException();
|
||||
|
||||
/**
|
||||
* Constructor which takes an error code and an optional message code.
|
||||
*
|
||||
* @param code The error code which indicates the exception
|
||||
* @param messageCode The string containing the error message
|
||||
* @param memoryManager The memory manager used to (de)allocate memory
|
||||
*/
|
||||
DOMException(short code,
|
||||
short messageCode = 0,
|
||||
MemoryManager* const memoryManager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
/**
|
||||
* Copy constructor.
|
||||
*
|
||||
* @param other The object to be copied.
|
||||
*/
|
||||
DOMException(const DOMException &other);
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Destructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor. */
|
||||
//@{
|
||||
/**
|
||||
* Destructor for DOMException.
|
||||
*
|
||||
*/
|
||||
virtual ~DOMException();
|
||||
//@}
|
||||
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter
|
||||
// -----------------------------------------------------------------------
|
||||
inline const XMLCh* getMessage() const;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Class Types
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Public variables */
|
||||
//@{
|
||||
/**
|
||||
* A code value, from the set defined by the ExceptionCode enum,
|
||||
* indicating the type of error that occured.
|
||||
*/
|
||||
short code;
|
||||
|
||||
/**
|
||||
* A string value. Applications may use this field to hold an error
|
||||
* message. The field value is not set by the DOM implementation,
|
||||
* meaning that the string will be empty when an exception is first
|
||||
* thrown.
|
||||
*/
|
||||
const XMLCh *msg;
|
||||
//@}
|
||||
|
||||
protected:
|
||||
MemoryManager* fMemoryManager;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* A boolean value.
|
||||
* If the message is provided by the applications, it is not
|
||||
* adopted.
|
||||
* If the message is resolved by the DOM implementation, it is
|
||||
* owned.
|
||||
*/
|
||||
bool fMsgOwned;
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMException & operator = (const DOMException &);
|
||||
};
|
||||
|
||||
inline const XMLCh* DOMException::getMessage() const
|
||||
{
|
||||
return msg;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMImplementation.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATION_HPP
|
||||
|
||||
#include <xercesc/dom/DOMImplementationLS.hpp>
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
#include <xercesc/dom/DOMLSException.hpp>
|
||||
#include <xercesc/dom/DOMRangeException.hpp>
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMDocument;
|
||||
class DOMDocumentType;
|
||||
|
||||
/**
|
||||
* The <code>DOMImplementation</code> interface provides a number of methods
|
||||
* for performing operations that are independent of any particular instance
|
||||
* of the document object model.
|
||||
*/
|
||||
|
||||
class CDOM_EXPORT DOMImplementation : public DOMImplementationLS
|
||||
{
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMImplementation() {}; // no plain constructor
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMImplementation(const DOMImplementation &); // no copy constructor.
|
||||
DOMImplementation & operator = (const DOMImplementation &); // No Assignment
|
||||
//@}
|
||||
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMImplementation() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMImplementation interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 1 */
|
||||
//@{
|
||||
/**
|
||||
* Test if the DOM implementation implements a specific feature.
|
||||
* @param feature The name of the feature to test (case-insensitive). The
|
||||
* values used by DOM features are defined throughout the DOM Level 2
|
||||
* specifications and listed in the section. The name must be an XML
|
||||
* name. To avoid possible conflicts, as a convention, names referring
|
||||
* to features defined outside the DOM specification should be made
|
||||
* unique.
|
||||
* @param version This is the version number of the feature to test. In
|
||||
* Level 2, the string can be either "2.0" or "1.0". If the version is
|
||||
* not specified, supporting any version of the feature causes the
|
||||
* method to return <code>true</code>.
|
||||
* @return <code>true</code> if the feature is implemented in the
|
||||
* specified version, <code>false</code> otherwise.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual bool hasFeature(const XMLCh *feature, const XMLCh *version) const = 0;
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Functions introduced in DOM Level 2
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 2 */
|
||||
//@{
|
||||
/**
|
||||
* Creates an empty <code>DOMDocumentType</code> node. Entity declarations
|
||||
* and notations are not made available. Entity reference expansions and
|
||||
* default attribute additions do not occur. It is expected that a
|
||||
* future version of the DOM will provide a way for populating a
|
||||
* <code>DOMDocumentType</code>.
|
||||
* @param qualifiedName The qualified name of the document type to be
|
||||
* created.
|
||||
* @param publicId The external subset public identifier.
|
||||
* @param systemId The external subset system identifier.
|
||||
* @return A new <code>DOMDocumentType</code> node with
|
||||
* <code>ownerDocument</code> set to <code>null</code>.
|
||||
* @exception DOMException
|
||||
* INVALID_CHARACTER_ERR: Raised if the specified qualified name
|
||||
* contains an illegal character.
|
||||
* <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
|
||||
* malformed.
|
||||
* <br>NOT_SUPPORTED_ERR: May be raised by DOM implementations which do
|
||||
* not support the <code>"XML"</code> feature, if they choose not to
|
||||
* support this method. Other features introduced in the future, by
|
||||
* the DOM WG or in extensions defined by other groups, may also
|
||||
* demand support for this method; please consult the definition of
|
||||
* the feature to see if it requires this method.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMDocumentType *createDocumentType(const XMLCh *qualifiedName,
|
||||
const XMLCh *publicId,
|
||||
const XMLCh *systemId) = 0;
|
||||
|
||||
/**
|
||||
* Creates a DOMDocument object of the specified type with its document
|
||||
* element.
|
||||
* @param namespaceURI The namespace URI of the document element to
|
||||
* create.
|
||||
* @param qualifiedName The qualified name of the document element to be
|
||||
* created.
|
||||
* @param doctype The type of document to be created or <code>null</code>.
|
||||
* When <code>doctype</code> is not <code>null</code>, its
|
||||
* <code>ownerDocument</code> attribute is set to the document
|
||||
* being created.
|
||||
* @param manager Pointer to the memory manager to be used to
|
||||
* allocate objects.
|
||||
* @return A new <code>DOMDocument</code> object.
|
||||
* @exception DOMException
|
||||
* INVALID_CHARACTER_ERR: Raised if the specified qualified name
|
||||
* contains an illegal character.
|
||||
* <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
|
||||
* malformed, if the <code>qualifiedName</code> has a prefix and the
|
||||
* <code>namespaceURI</code> is <code>null</code>, or if the
|
||||
* <code>qualifiedName</code> has a prefix that is "xml" and the
|
||||
* <code>namespaceURI</code> is different from "
|
||||
* http://www.w3.org/XML/1998/namespace" , or if the DOM
|
||||
* implementation does not support the <code>"XML"</code> feature but
|
||||
* a non-null namespace URI was provided, since namespaces were
|
||||
* defined by XML.
|
||||
* <br>WRONG_DOCUMENT_ERR: Raised if <code>doctype</code> has already
|
||||
* been used with a different document or was created from a different
|
||||
* implementation.
|
||||
* <br>NOT_SUPPORTED_ERR: May be raised by DOM implementations which do
|
||||
* not support the "XML" feature, if they choose not to support this
|
||||
* method. Other features introduced in the future, by the DOM WG or
|
||||
* in extensions defined by other groups, may also demand support for
|
||||
* this method; please consult the definition of the feature to see if
|
||||
* it requires this method.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
|
||||
virtual DOMDocument *createDocument(const XMLCh *namespaceURI,
|
||||
const XMLCh *qualifiedName,
|
||||
DOMDocumentType *doctype,
|
||||
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
|
||||
|
||||
//@}
|
||||
// -----------------------------------------------------------------------
|
||||
// Functions introduced in DOM Level 3
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
/**
|
||||
* This method returns a specialized object which implements the specialized APIs
|
||||
* of the specified feature and version, as specified in DOM Features.
|
||||
* This method also allow the implementation to provide specialized objects which
|
||||
* do not support the <code>DOMImplementation</code> interface.
|
||||
*
|
||||
* @param feature The name of the feature requested (case-insensitive).
|
||||
* Note that any plus sign "+" prepended to the name of the feature will
|
||||
* be ignored since it is not significant in the context of this method.
|
||||
* @param version This is the version number of the feature to test.
|
||||
* @return Returns an object which implements the specialized APIs of the specified
|
||||
* feature and version, if any, or null if there is no object which implements
|
||||
* interfaces associated with that feature.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void* getFeature(const XMLCh* feature, const XMLCh* version) const = 0;
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard extension */
|
||||
//@{
|
||||
/**
|
||||
* Non-standard extension
|
||||
*
|
||||
* Create a completely empty document that has neither a root element or a doctype node.
|
||||
*/
|
||||
virtual DOMDocument *createDocument(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
|
||||
|
||||
/**
|
||||
* Non-standard extension
|
||||
*
|
||||
* Factory method for getting a DOMImplementation object.
|
||||
* The DOM implementation retains ownership of the returned object.
|
||||
* Application code should NOT delete it.
|
||||
*/
|
||||
static DOMImplementation *getImplementation();
|
||||
|
||||
/**
|
||||
* Non-standard extension
|
||||
*
|
||||
* Load the default error text message for DOMException.
|
||||
* @param msgToLoad The DOM ExceptionCode id to be processed
|
||||
* @param toFill The buffer that will hold the output on return. The
|
||||
* size of this buffer should at least be 'maxChars + 1'.
|
||||
* @param maxChars The maximum number of output characters that can be
|
||||
* accepted. If the result will not fit, it is an error.
|
||||
* @return <code>true</code> if the message is successfully loaded
|
||||
*/
|
||||
static bool loadDOMExceptionMsg
|
||||
(
|
||||
const short msgToLoad
|
||||
, XMLCh* const toFill
|
||||
, const XMLSize_t maxChars
|
||||
);
|
||||
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMImplementationLS.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONLS_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONLS_HPP
|
||||
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMLSParser;
|
||||
class DOMLSSerializer;
|
||||
class DOMLSInput;
|
||||
class DOMLSOutput;
|
||||
class MemoryManager;
|
||||
class XMLGrammarPool;
|
||||
|
||||
/**
|
||||
* <p><code>DOMImplementationLS</code> contains the factory methods for
|
||||
* creating Load and Save objects.</p>
|
||||
*
|
||||
* <p>An object that implements DOMImplementationLS is obtained by doing a
|
||||
* binding specific cast from DOMImplementation to DOMImplementationLS.
|
||||
* Implementations supporting the Load and Save feature must implement the
|
||||
* DOMImplementationLS interface on whatever object implements the
|
||||
* DOMImplementation interface.</p>
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
class CDOM_EXPORT DOMImplementationLS
|
||||
{
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMImplementationLS() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMImplementationLS(const DOMImplementationLS &);
|
||||
DOMImplementationLS & operator = (const DOMImplementationLS &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMImplementationLS() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Public constants
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Public constants */
|
||||
//@{
|
||||
/**
|
||||
* Create a synchronous or an asynchronous <code>DOMLSParser</code>.
|
||||
* @see createLSParser(const DOMImplementationLSMode mode, const XMLCh* const schemaType)
|
||||
* @since DOM Level 3
|
||||
*
|
||||
*/
|
||||
enum DOMImplementationLSMode
|
||||
{
|
||||
MODE_SYNCHRONOUS = 1,
|
||||
MODE_ASYNCHRONOUS = 2
|
||||
};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMImplementationLS interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Factory create methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Create a new DOMLSParser. The newly constructed parser may then be configured
|
||||
* by means of its DOMConfiguration object, and used to parse documents by
|
||||
* means of its parse method.
|
||||
*
|
||||
* @param mode The mode argument is either <code>MODE_SYNCHRONOUS</code>
|
||||
* or <code>MODE_ASYNCHRONOUS</code>, if mode is <code>MODE_SYNCHRONOUS</code>
|
||||
* then the <code>DOMLSParser</code> that is created will operate in synchronous
|
||||
* mode, if it's <code>MODE_ASYNCHRONOUS</code> then the <code>DOMLSParser</code>
|
||||
* that is created will operate in asynchronous mode.
|
||||
* @param schemaType An absolute URI representing the type of the schema
|
||||
* language used during the load of a <code>DOMDocument</code> using the newly
|
||||
* created <code>DOMLSParser</code>. Note that no lexical checking is done on
|
||||
* the absolute URI. In order to create a <code>DOMLSParser</code> for any kind
|
||||
* of schema types (i.e. the <code>DOMLSParser</code> will be free to use any
|
||||
* schema found), use the value <code>NULL</code>.
|
||||
* <b>Note</b>: For W3C XML Schema [XML Schema Part 1], applications must use
|
||||
* the value "http://www.w3.org/2001/XMLSchema". For XML DTD [XML 1.0],
|
||||
* applications must use the value "http://www.w3.org/TR/REC-xml".
|
||||
* Other Schema languages are outside the scope of the W3C and therefore should
|
||||
* recommend an absolute URI in order to use this method.
|
||||
* @param manager Pointer to the memory manager to be used to allocate objects.
|
||||
* @param gramPool The collection of cached grammars.
|
||||
* @return The newly created <code>DOMLSParser</code> object. This
|
||||
* <code>DOMLSParser</code> is either synchronous or asynchronous depending
|
||||
* on the value of the <code>mode</code> argument.
|
||||
* @exception DOMException NOT_SUPPORTED_ERR: Raised if the requested mode
|
||||
* or schema type is not supported.
|
||||
*
|
||||
* @see DOMLSParser
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMLSParser* createLSParser(const DOMImplementationLSMode mode,
|
||||
const XMLCh* const schemaType,
|
||||
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager,
|
||||
XMLGrammarPool* const gramPool = 0) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new DOMLSSerializer. DOMLSSerializer is used to serialize a DOM tree
|
||||
* back into an XML document.
|
||||
*
|
||||
* @return The newly created <code>DOMLSSerializer</code> object.
|
||||
*
|
||||
* @see DOMLSSerializer
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMLSSerializer* createLSSerializer(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
|
||||
|
||||
/**
|
||||
* Create a new "empty" DOMLSInput.
|
||||
*
|
||||
* @return The newly created <code>DOMLSInput</code> object.
|
||||
*
|
||||
* @see DOMLSInput
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMLSInput* createLSInput(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
|
||||
|
||||
/**
|
||||
* Create a new "empty" LSOutput.
|
||||
*
|
||||
* @return The newly created <code>LSOutput</code> object.
|
||||
*
|
||||
* @see LSOutput
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMLSOutput* createLSOutput(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
|
||||
//@}
|
||||
};
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMImplementationList.hpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONLIST_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONLIST_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMImplementation;
|
||||
|
||||
|
||||
/**
|
||||
* The <code>DOMImplementationList</code> interface provides the abstraction of an ordered
|
||||
* collection of DOM implementations, without defining or constraining how this collection
|
||||
* is implemented. The items in the <code>DOMImplementationList</code> are accessible via
|
||||
* an integral index, starting from 0.
|
||||
*/
|
||||
|
||||
class CDOM_EXPORT DOMImplementationList {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMImplementationList() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMImplementationList(const DOMImplementationList &);
|
||||
DOMImplementationList & operator = (const DOMImplementationList &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMImplementationList() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMImplementationList interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns the <code>index</code> item in the collection.
|
||||
*
|
||||
* If <code>index</code> is greater than or equal to the number of DOMImplementation in
|
||||
* the list, this returns <code>null</code>.
|
||||
*
|
||||
* @param index Index into the collection.
|
||||
* @return The DOMImplementation at the <code>index</code>th position in the
|
||||
* <code>DOMImplementationList</code>, or <code>null</code> if that is not a valid
|
||||
* index.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMImplementation *item(XMLSize_t index) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of DOMImplementation in the list.
|
||||
*
|
||||
* The range of valid child node indices is 0 to <code>length-1</code> inclusive.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual XMLSize_t getLength() const = 0;
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard Extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard Extension */
|
||||
//@{
|
||||
/**
|
||||
* Called to indicate that this list is no longer in use
|
||||
* and that the implementation may relinquish any resources associated with it and
|
||||
* its associated children.
|
||||
*
|
||||
* Access to a released object will lead to unexpected result.
|
||||
*
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMImplementationRegistry.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONREGISTRY_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONREGISTRY_HPP
|
||||
|
||||
/**
|
||||
* This class holds the list of registered DOMImplementations. Implementation
|
||||
* or application can register DOMImplementationSource to the registry, and
|
||||
* then can query DOMImplementation based on a list of requested features.
|
||||
*
|
||||
* <p>This provides an application with an implementation independent starting
|
||||
* point.
|
||||
*
|
||||
* @see DOMImplementation
|
||||
* @see DOMImplementationList
|
||||
* @see DOMImplementationSource
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMImplementation;
|
||||
class DOMImplementationSource;
|
||||
class DOMImplementationList;
|
||||
|
||||
class CDOM_EXPORT DOMImplementationRegistry
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Static DOMImplementationRegistry interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
/**
|
||||
* Return the first registered implementation that has the desired features,
|
||||
* or null if none is found.
|
||||
*
|
||||
* @param features A string that specifies which features are required.
|
||||
* This is a space separated list in which each feature is
|
||||
* specified by its name optionally followed by a space
|
||||
* and a version number.
|
||||
* This is something like: "XML 1.0 Traversal 2.0"
|
||||
* @return An implementation that has the desired features, or
|
||||
* <code>null</code> if this source has none.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
static DOMImplementation* getDOMImplementation(const XMLCh* features);
|
||||
|
||||
/**
|
||||
* Return the list of registered implementation that have the desired features.
|
||||
*
|
||||
* @param features A string that specifies which features are required.
|
||||
* This is a space separated list in which each feature is
|
||||
* specified by its name optionally followed by a space
|
||||
* and a version number.
|
||||
* This is something like: "XML 1.0 Traversal 2.0"
|
||||
* @return A DOMImplementationList object that contains the DOMImplementation
|
||||
* that have the desired features
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
static DOMImplementationList* getDOMImplementationList(const XMLCh* features);
|
||||
|
||||
/**
|
||||
* Register an implementation.
|
||||
*
|
||||
* @param source A DOMImplementation Source object to be added to the registry.
|
||||
* The registry does NOT adopt the source object. Users still own it.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
static void addSource(DOMImplementationSource* source);
|
||||
//@}
|
||||
|
||||
private:
|
||||
DOMImplementationRegistry();
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMImplementationSource.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONSOURCE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONSOURCE_HPP
|
||||
|
||||
/**
|
||||
* This interface permits a DOM implementer to supply one or more
|
||||
* implementations, based upon requested features and versions. Each implemented
|
||||
* <code>DOMImplementationSource</code> object is listed in the
|
||||
* binding-specific list of available sources so that its
|
||||
* <code>DOMImplementation</code> objects are made available.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMImplementation;
|
||||
class DOMImplementationList;
|
||||
|
||||
class CDOM_EXPORT DOMImplementationSource
|
||||
{
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMImplementationSource() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMImplementationSource(const DOMImplementationSource &);
|
||||
DOMImplementationSource & operator = (const DOMImplementationSource &);
|
||||
//@}
|
||||
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMImplementationSource() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMImplementationSource interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
/**
|
||||
* A method to request the first DOM implementation that supports the specified features.
|
||||
*
|
||||
* @param features A string that specifies which features are required.
|
||||
* This is a space separated list in which each feature is specified
|
||||
* by its name optionally followed by a space and a version number.
|
||||
* This is something like: "XML 1.0 Traversal 2.0"
|
||||
* @return An implementation that has the desired features, or
|
||||
* <code>null</code> if this source has none.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMImplementation* getDOMImplementation(const XMLCh* features) const = 0;
|
||||
|
||||
/**
|
||||
* A method to request a list of DOM implementations that support the specified features and versions,
|
||||
*
|
||||
* @param features A string that specifies which features are required.
|
||||
* This is a space separated list in which each feature is specified
|
||||
* by its name optionally followed by a space and a version number.
|
||||
* This is something like: "XML 1.0 Traversal 2.0"
|
||||
* @return A list of DOM implementations that support the desired features
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMImplementationList* getDOMImplementationList(const XMLCh* features) const = 0;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMLSException.cpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#include "DOMLSException.hpp"
|
||||
#include <xercesc/util/XMLDOMMsg.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
DOMLSException::DOMLSException()
|
||||
: DOMException()
|
||||
{
|
||||
}
|
||||
|
||||
DOMLSException::DOMLSException(short exCode,
|
||||
short messageCode,
|
||||
MemoryManager* const memoryManager)
|
||||
: DOMException(exCode, messageCode?messageCode:XMLDOMMsg::DOMLSEXCEPTION_ERRX+exCode-DOMLSException::PARSE_ERR+1, memoryManager)
|
||||
{
|
||||
}
|
||||
|
||||
DOMLSException::DOMLSException(const DOMLSException &other)
|
||||
: DOMException(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DOMLSException::~DOMLSException()
|
||||
{
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMLSException.hpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMLSEXCEPTION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMLSEXCEPTION_HPP
|
||||
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* Parser or write operations may throw an LSException if the processing is stopped.
|
||||
* The processing can be stopped due to a <code>DOMError</code> with a severity of
|
||||
* DOMError::DOM_SEVERITY_FATAL_ERROR or a non recovered DOMError::DOM_SEVERITY_ERROR,
|
||||
* or if <code>DOMErrorHandler::handleError()</code> returned <code>false</code>.
|
||||
* <p><b>Note</b>: As suggested in the definition of the constants in the <code>DOMError</code>
|
||||
* interface, a DOM implementation may choose to continue after a fatal error, but the
|
||||
* resulting DOM tree is then implementation dependent.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/DOM3-LS.html'>
|
||||
* Document Object Model (DOM) Level 3 Load and Save Specification</a>.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
|
||||
class MemoryManager;
|
||||
|
||||
class CDOM_EXPORT DOMLSException : public DOMException {
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Class Types
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Public Contants */
|
||||
//@{
|
||||
/**
|
||||
* ExceptionCode
|
||||
*
|
||||
* <p><code>PARSE_ERR:</code>
|
||||
* If an attempt was made to load a document, or an XML Fragment, using DOMLSParser
|
||||
* and the processing has been stopped.</p>
|
||||
*
|
||||
* <p><code>SERIALIZE_ERR:</code>
|
||||
* If an attempt was made to serialize a Node using LSSerializer and the processing
|
||||
* has been stopped.</p>
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
enum LSExceptionCode {
|
||||
PARSE_ERR = 81,
|
||||
SERIALIZE_ERR = 82
|
||||
};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
/**
|
||||
* Default constructor for DOMLSException.
|
||||
*
|
||||
*/
|
||||
DOMLSException();
|
||||
|
||||
/**
|
||||
* Constructor which takes an error code and a message.
|
||||
*
|
||||
* @param code The error code which indicates the exception
|
||||
* @param messageCode The string containing the error message
|
||||
* @param memoryManager The memory manager used to (de)allocate memory
|
||||
*/
|
||||
DOMLSException(short code,
|
||||
short messageCode,
|
||||
MemoryManager* const memoryManager);
|
||||
|
||||
/**
|
||||
* Copy constructor.
|
||||
*
|
||||
* @param other The object to be copied.
|
||||
*/
|
||||
DOMLSException(const DOMLSException &other);
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Destructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor. */
|
||||
//@{
|
||||
/**
|
||||
* Destructor for DOMLSException.
|
||||
*
|
||||
*/
|
||||
virtual ~DOMLSException();
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMLSException & operator = (const DOMLSException &);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMLSInput.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMLSINPUT_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMLSINPUT_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class InputSource;
|
||||
|
||||
|
||||
/**
|
||||
* This interface represents a single input source for an XML entity.
|
||||
*
|
||||
* <p>This interface allows an application to encapsulate information about
|
||||
* an input source in a single object, which may include a public identifier,
|
||||
* a system identifier, a byte stream (possibly with a specified encoding),
|
||||
* and/or a character stream.</p>
|
||||
*
|
||||
* <p>There are two places that the application will deliver this input source
|
||||
* to the parser: as the argument to the parse method, or as the return value
|
||||
* of the DOMLSResourceResolver.resolveResource method.</p>
|
||||
*
|
||||
* <p>The DOMLSParser will use the DOMLSInput object to determine how to
|
||||
* read XML input. If there is a character stream available, the parser will
|
||||
* read that stream directly; if not, the parser will use a byte stream, if
|
||||
* available; if neither a character stream nor a byte stream is available,
|
||||
* the parser will attempt to open a URI connection to the resource identified
|
||||
* by the system identifier.</p>
|
||||
*
|
||||
* <p>A DOMLSInput object belongs to the application: the parser shall
|
||||
* never modify it in any way (it may modify a copy if necessary).</p>
|
||||
*
|
||||
* @see DOMLSParser#parse
|
||||
* @see DOMLSResourceResolver#resolveResource
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
class CDOM_EXPORT DOMLSInput
|
||||
{
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMLSInput() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMLSInput(const DOMLSInput &);
|
||||
DOMLSInput & operator = (const DOMLSInput &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMLSInput() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMLSInput interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* String data to parse. If provided, this will always be treated as a sequence of 16-bit units (UTF-16 encoded characters).
|
||||
* It is not a requirement to have an XML declaration when using stringData. If an XML declaration is present, the value of
|
||||
* the encoding attribute will be ignored.
|
||||
*
|
||||
*/
|
||||
virtual const XMLCh* getStringData() const = 0;
|
||||
|
||||
/**
|
||||
* Returns the byte stream for this input source.
|
||||
*
|
||||
* @see InputSource
|
||||
*/
|
||||
virtual InputSource* getByteStream() const = 0;
|
||||
|
||||
/**
|
||||
* An input source can be set to force the parser to assume a particular
|
||||
* encoding for the data that input source reprsents, via the setEncoding()
|
||||
* method. This method returns name of the encoding that is to be forced.
|
||||
* If the encoding has never been forced, it returns a null pointer.
|
||||
*
|
||||
* @return The forced encoding, or null if none was supplied.
|
||||
* @see #setEncoding
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getEncoding() const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get the public identifier for this input source.
|
||||
*
|
||||
* @return The public identifier, or null if none was supplied.
|
||||
* @see #setPublicId
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getPublicId() const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get the system identifier for this input source.
|
||||
*
|
||||
* <p>If the system ID is a URL, it will be fully resolved.</p>
|
||||
*
|
||||
* @return The system identifier.
|
||||
* @see #setSystemId
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getSystemId() const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get the base URI to be used for resolving relative URIs to absolute
|
||||
* URIs. If the baseURI is itself a relative URI, the behavior is
|
||||
* implementation dependent.
|
||||
*
|
||||
* @return The base URI.
|
||||
* @see #setBaseURI
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getBaseURI() const = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the UTF-16 string for this input source.
|
||||
*
|
||||
*/
|
||||
virtual void setStringData(const XMLCh* data) = 0;
|
||||
|
||||
/**
|
||||
* Sets the byte stream for this input source.
|
||||
*
|
||||
* @see BinInputStream
|
||||
*/
|
||||
virtual void setByteStream(InputSource* stream) = 0;
|
||||
|
||||
/**
|
||||
* Set the encoding which will be required for use with the XML text read
|
||||
* via a stream opened by this input source.
|
||||
*
|
||||
* <p>This is usually not set, allowing the encoding to be sensed in the
|
||||
* usual XML way. However, in some cases, the encoding in the file is known
|
||||
* to be incorrect because of intermediate transcoding, for instance
|
||||
* encapsulation within a MIME document.
|
||||
*
|
||||
* @param encodingStr The name of the encoding to force.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setEncoding(const XMLCh* const encodingStr) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the public identifier for this input source.
|
||||
*
|
||||
* <p>The public identifier is always optional: if the application writer
|
||||
* includes one, it will be provided as part of the location information.</p>
|
||||
*
|
||||
* @param publicId The public identifier as a string.
|
||||
* @see #getPublicId
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setPublicId(const XMLCh* const publicId) = 0;
|
||||
|
||||
/**
|
||||
* Set the system identifier for this input source.
|
||||
*
|
||||
* <p>The system id is always required. The public id may be used to map
|
||||
* to another system id, but the system id must always be present as a fall
|
||||
* back.</p>
|
||||
*
|
||||
* <p>If the system ID is a URL, it must be fully resolved.</p>
|
||||
*
|
||||
* @param systemId The system identifier as a string.
|
||||
* @see #getSystemId
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setSystemId(const XMLCh* const systemId) = 0;
|
||||
|
||||
/**
|
||||
* Set the base URI to be used for resolving relative URIs to absolute
|
||||
* URIs. If the baseURI is itself a relative URI, the behavior is
|
||||
* implementation dependent.
|
||||
*
|
||||
* @param baseURI The base URI.
|
||||
* @see #getBaseURI
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setBaseURI(const XMLCh* const baseURI) = 0;
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard Extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard Extension */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Indicates if the parser should issue fatal error if this input source
|
||||
* is not found. If set to false, the parser issue warning message instead.
|
||||
*
|
||||
* @param flag True if the parser should issue fatal error if this input source is not found.
|
||||
* If set to false, the parser issue warning message instead. (Default: true)
|
||||
*
|
||||
* @see #getIssueFatalErrorIfNotFound
|
||||
*/
|
||||
virtual void setIssueFatalErrorIfNotFound(bool flag) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get the flag that indicates if the parser should issue fatal error if this input source
|
||||
* is not found.
|
||||
*
|
||||
* @return True if the parser should issue fatal error if this input source is not found.
|
||||
* False if the parser issue warning message instead.
|
||||
* @see #setIssueFatalErrorIfNotFound
|
||||
*/
|
||||
virtual bool getIssueFatalErrorIfNotFound() const = 0;
|
||||
|
||||
/**
|
||||
* Called to indicate that this DOMLSInput is no longer in use
|
||||
* and that the implementation may relinquish any resources associated with it.
|
||||
*
|
||||
* Access to a released object will lead to unexpected result.
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
//@}
|
||||
};
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMLSOutput.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMLSOUTPUT_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMLSOUTPUT_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class XMLFormatTarget;
|
||||
|
||||
|
||||
/**
|
||||
* This interface represents an output destination for data.
|
||||
*
|
||||
* @see XMLFormatTarget
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
class CDOM_EXPORT DOMLSOutput
|
||||
{
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMLSOutput() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMLSOutput(const DOMLSOutput &);
|
||||
DOMLSOutput & operator = (const DOMLSOutput &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMLSOutput() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMLSOutput interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns the byte stream for this input source.
|
||||
*
|
||||
* @see InputSource
|
||||
*/
|
||||
virtual XMLFormatTarget* getByteStream() const = 0;
|
||||
|
||||
/**
|
||||
* An input source can be set to force the parser to assume a particular
|
||||
* encoding for the data that input source reprsents, via the setEncoding()
|
||||
* method. This method returns name of the encoding that is to be forced.
|
||||
* If the encoding has never been forced, it returns a null pointer.
|
||||
*
|
||||
* @return The forced encoding, or null if none was supplied.
|
||||
* @see #setEncoding
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getEncoding() const = 0;
|
||||
|
||||
/**
|
||||
* Get the system identifier for this input source.
|
||||
*
|
||||
* <p>If the system ID is a URL, it will be fully resolved.</p>
|
||||
*
|
||||
* @return The system identifier.
|
||||
* @see #setSystemId
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getSystemId() const = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the byte stream for this input source.
|
||||
*
|
||||
* @see BinInputStream
|
||||
*/
|
||||
virtual void setByteStream(XMLFormatTarget* stream) = 0;
|
||||
|
||||
/**
|
||||
* Set the encoding which will be required for use with the XML text read
|
||||
* via a stream opened by this input source.
|
||||
*
|
||||
* <p>This is usually not set, allowing the encoding to be sensed in the
|
||||
* usual XML way. However, in some cases, the encoding in the file is known
|
||||
* to be incorrect because of intermediate transcoding, for instance
|
||||
* encapsulation within a MIME document.
|
||||
*
|
||||
* @param encodingStr The name of the encoding to force.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setEncoding(const XMLCh* const encodingStr) = 0;
|
||||
|
||||
/**
|
||||
* Set the system identifier for this input source.
|
||||
*
|
||||
* <p>The system id is always required. The public id may be used to map
|
||||
* to another system id, but the system id must always be present as a fall
|
||||
* back.</p>
|
||||
*
|
||||
* <p>If the system ID is a URL, it must be fully resolved.</p>
|
||||
*
|
||||
* @param systemId The system identifier as a string.
|
||||
* @see #getSystemId
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setSystemId(const XMLCh* const systemId) = 0;
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard Extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard Extension */
|
||||
//@{
|
||||
/**
|
||||
* Called to indicate that this DOMLSOutput is no longer in use
|
||||
* and that the implementation may relinquish any resources associated with it.
|
||||
*
|
||||
* Access to a released object will lead to unexpected result.
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
//@}
|
||||
};
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,766 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMLSParser.hpp 832686 2009-11-04 08:55:59Z borisk $
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMLSPARSER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMLSPARSER_HPP
|
||||
|
||||
#include <xercesc/dom/DOMConfiguration.hpp>
|
||||
#include <xercesc/dom/DOMLSParserFilter.hpp>
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/validators/common/Grammar.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMErrorHandler;
|
||||
class DOMLSInput;
|
||||
class DOMNode;
|
||||
class DOMDocument;
|
||||
|
||||
/**
|
||||
* DOMLSParser provides an API for parsing XML documents and building the
|
||||
* corresponding DOM document tree. A DOMLSParser instance is obtained from
|
||||
* the DOMImplementationLS interface by invoking its createLSParser method.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*
|
||||
*/
|
||||
class CDOM_EXPORT DOMLSParser
|
||||
{
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMLSParser() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMLSParser(const DOMLSParser &);
|
||||
DOMLSParser & operator = (const DOMLSParser &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMLSParser() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Class types
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Public Constants */
|
||||
//@{
|
||||
/**
|
||||
* A set of possible actions for the parseWithContext method.
|
||||
*
|
||||
* <p><code>ACTION_APPEND_AS_CHILDREN</code>:
|
||||
* Append the result of the parse operation as children of the context node.
|
||||
* For this action to work, the context node must be a <code>DOMElement</code>
|
||||
* or a <code>DOMDocumentFragment</code>. </p>
|
||||
*
|
||||
* <p><code>ACTION_INSERT_AFTER</code>:
|
||||
* Insert the result of the parse operation as the immediately following sibling
|
||||
* of the context node. For this action to work the context node's parent must
|
||||
* be a <code>DOMElement</code> or a <code>DOMDocumentFragment</code>. </p>
|
||||
*
|
||||
* <p><code>ACTION_INSERT_BEFORE</code>:
|
||||
* Insert the result of the parse operation as the immediately preceding sibling
|
||||
* of the context node. For this action to work the context node's parent must
|
||||
* be a <code>DOMElement</code> or a <code>DOMDocumentFragment</code>. </p>
|
||||
*
|
||||
* <p><code>ACTION_REPLACE</code>:
|
||||
* Replace the context node with the result of the parse operation. For this
|
||||
* action to work, the context node must have a parent, and the parent must be
|
||||
* a <code>DOMElement</code> or a <code>DOMDocumentFragment</code>. </p>
|
||||
*
|
||||
* <p><code>ACTION_REPLACE_CHILDREN</code>:
|
||||
* Replace all the children of the context node with the result of the parse
|
||||
* operation. For this action to work, the context node must be a <code>DOMElement</code>,
|
||||
* a <code>DOMDocument</code>, or a <code>DOMDocumentFragment</code>. </p>
|
||||
*
|
||||
* @see parseWithContext(...)
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
enum ActionType
|
||||
{
|
||||
ACTION_APPEND_AS_CHILDREN = 1,
|
||||
ACTION_REPLACE_CHILDREN = 2,
|
||||
ACTION_INSERT_BEFORE = 3,
|
||||
ACTION_INSERT_AFTER = 4,
|
||||
ACTION_REPLACE = 5
|
||||
};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMLSParser interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get a pointer to the <code>DOMConfiguration</code> object used when parsing
|
||||
* an input source.
|
||||
* This <code>DOMConfiguration</code> is specific to the parse operation.
|
||||
* No parameter values from this <code>DOMConfiguration</code> object are passed
|
||||
* automatically to the <code>DOMConfiguration</code> object on the
|
||||
* <code>DOMDocument</code> that is created, or used, by the parse operation.
|
||||
* The DOM application is responsible for passing any needed parameter values
|
||||
* from this <code>DOMConfiguration</code> object to the <code>DOMConfiguration</code>
|
||||
* object referenced by the <code>DOMDocument</code> object.
|
||||
*
|
||||
* In addition to the parameters recognized in on the <code>DOMConfiguration</code>
|
||||
* interface defined in [DOM Level 3 Core], the <code>DOMConfiguration</code> objects
|
||||
* for <code>DOMLSParser</code> add or modify the following parameters:
|
||||
*
|
||||
* "charset-overrides-xml-encoding"
|
||||
* true [optional] (default)
|
||||
* If a higher level protocol such as HTTP [IETF RFC 2616] provides an
|
||||
* indication of the character encoding of the input stream being processed,
|
||||
* that will override any encoding specified in the XML declaration or the
|
||||
* Text declaration (see also section 4.3.3, "Character Encoding in Entities",
|
||||
* in [XML 1.0]). Explicitly setting an encoding in the <code>DOMLSInput</code>
|
||||
* overrides any encoding from the protocol.
|
||||
* false [required]
|
||||
* The parser ignores any character set encoding information from higher-level
|
||||
* protocols.
|
||||
*
|
||||
* "disallow-doctype"
|
||||
* true [optional]
|
||||
* Throw a fatal "doctype-not-allowed" error if a doctype node is found while
|
||||
* parsing the document. This is useful when dealing with things like SOAP
|
||||
* envelopes where doctype nodes are not allowed.
|
||||
* false [required] (default)
|
||||
* Allow doctype nodes in the document.
|
||||
*
|
||||
* "ignore-unknown-character-denormalizations"
|
||||
* true [required] (default)
|
||||
* If, while verifying full normalization when [XML 1.1] is supported, a
|
||||
* processor encounters characters for which it cannot determine the normalization
|
||||
* properties, then the processor will ignore any possible denormalizations
|
||||
* caused by these characters.
|
||||
* This parameter is ignored for [XML 1.0].
|
||||
* false [optional]
|
||||
* Report an fatal "unknown-character-denormalization" error if a character
|
||||
* is encountered for which the processor cannot determine the normalization
|
||||
* properties.
|
||||
*
|
||||
* "infoset"
|
||||
* See the definition of DOMConfiguration for a description of this parameter.
|
||||
* Unlike in [DOM Level 3 Core], this parameter will default to true for DOMLSParser.
|
||||
*
|
||||
* "namespaces"
|
||||
* true [required] (default)
|
||||
* Perform the namespace processing as defined in [XML Namespaces] and
|
||||
* [XML Namespaces 1.1].
|
||||
* false [optional]
|
||||
* Do not perform the namespace processing.
|
||||
*
|
||||
* "resource-resolver" [required]
|
||||
* A pointer to a DOMLSResourceResolver object, or NULL. If the value of this parameter
|
||||
* is not null when an external resource (such as an external XML entity or an XML schema
|
||||
* location) is encountered, the implementation will request that the DOMLSResourceResolver
|
||||
* referenced in this parameter resolves the resource.
|
||||
*
|
||||
* "supported-media-types-only"
|
||||
* true [optional]
|
||||
* Check that the media type of the parsed resource is a supported media type. If
|
||||
* an unsupported media type is encountered, a fatal error of type "unsupported-media-type"
|
||||
* will be raised. The media types defined in [IETF RFC 3023] must always be accepted.
|
||||
* false [required] (default)
|
||||
* Accept any media type.
|
||||
*
|
||||
* "validate"
|
||||
* See the definition of <code>DOMConfiguration</code> for a description of this parameter.
|
||||
* Unlike in [DOM Level 3 Core], the processing of the internal subset is always accomplished, even
|
||||
* if this parameter is set to false.
|
||||
*
|
||||
* "validate-if-schema"
|
||||
* See the definition of <code>DOMConfiguration</code> for a description of this parameter.
|
||||
* Unlike in [DOM Level 3 Core], the processing of the internal subset is always accomplished, even
|
||||
* if this parameter is set to false.
|
||||
*
|
||||
* "well-formed"
|
||||
* See the definition of <code>DOMConfiguration</code> for a description of this parameter.
|
||||
* Unlike in [DOM Level 3 Core], this parameter cannot be set to false.
|
||||
*
|
||||
* In addition to these, Xerces adds these non standard parameters:
|
||||
*
|
||||
* "http://apache.org/xml/properties/entity-resolver"
|
||||
* A pointer to a XMLEntityResolver object, or NULL. If the value of this parameter
|
||||
* is not null when an external resource (such as an external XML entity or an XML schema
|
||||
* location) is encountered, the implementation will request that the XMLEntityResolver
|
||||
* referenced in this parameter resolves the resource.
|
||||
*
|
||||
* "http://apache.org/xml/properties/schema/external-schemaLocation"
|
||||
* A string holding a set of [namespaceUri schemaLocation] entries that will be treated as
|
||||
* the content of the attribute xsi:schemaLocation of the root element
|
||||
*
|
||||
* "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
|
||||
* A string holding the schemaLocation for the empty namespace URI that will be treated as
|
||||
* the content of the attribute xsi:noNamespaceSchemaLocation of the root element
|
||||
*
|
||||
* "http://apache.org/xml/properties/security-manager"
|
||||
* A pointer to a SecurityManager object that will control how many entity references will be
|
||||
* expanded during parsing
|
||||
*
|
||||
* "http://apache.org/xml/properties/scannerName"
|
||||
* A string holding the type of scanner used while parsing. The valid names are:
|
||||
* <ul>
|
||||
* <li>IGXMLScanner: the default one, capable of both XMLSchema and DTD validation</li>
|
||||
* <li>SGXMLScanner: a scanner that can only perform XMLSchema validation</li>
|
||||
* <li>DGXMLScanner: a scanner that can only perform DTD validation</li>
|
||||
* <li>WFXMLScanner: a scanner that cannot perform any type validation, only well-formedness</li>
|
||||
* </ul>
|
||||
*
|
||||
* "http://apache.org/xml/properties/parser-use-DOMDocument-from-Implementation"
|
||||
* A string holding the capabilities of the DOM implementation to be used to create the DOMDocument
|
||||
* resulting from the parse operation. For instance, "LS" or "Core"
|
||||
*
|
||||
* "http://apache.org/xml/features/validation/schema"
|
||||
* true
|
||||
* Enable XMLSchema validation (note that also namespace processing should be enabled)
|
||||
* false (default)
|
||||
* Don't perform XMLSchema validation
|
||||
*
|
||||
* "http://apache.org/xml/features/validation/schema-full-checking"
|
||||
* true
|
||||
* Turn on full XMLSchema checking (e.g. Unique Particle Attribution)
|
||||
* false (default)
|
||||
* Don't perform full XMLSchema checking
|
||||
*
|
||||
* "http://apache.org/xml/features/validating/load-schema"
|
||||
* true (default)
|
||||
* Allow the parser to load schemas that are not in the grammar pool
|
||||
* false
|
||||
* Schemas that are not in the grammar pool are ignored
|
||||
*
|
||||
* "http://apache.org/xml/features/dom/user-adopts-DOMDocument"
|
||||
* true
|
||||
* The DOMDocument objects returned by <code>parse</code> will be owned by the caller
|
||||
* false (default)
|
||||
* The DOMDocument objects returned by <code>parse</code> will be owned by this <code>DOMLSParser</code>
|
||||
* and deleted when released
|
||||
*
|
||||
* "http://apache.org/xml/features/nonvalidating/load-external-dtd"
|
||||
* true (default)
|
||||
* Allow the parser to load external DTDs
|
||||
* false
|
||||
* References to external DTDs will be ignored
|
||||
*
|
||||
* "http://apache.org/xml/features/continue-after-fatal-error"
|
||||
* true
|
||||
* Parsing should try to continue even if a fatal error has been triggered, trying to generate a DOM tree
|
||||
* from a non well-formed XML
|
||||
* false (default)
|
||||
* Violation of XML rules will abort parsing
|
||||
*
|
||||
* "http://apache.org/xml/features/validation-error-as-fatal"
|
||||
* true
|
||||
* Validation errors are treated as fatal errors, and abort parsing (unless "continue-after-fatal-error"
|
||||
* has been specified)
|
||||
* false (default)
|
||||
* Validation errors are normal errors
|
||||
*
|
||||
* "http://apache.org/xml/features/validation/cache-grammarFromParse"
|
||||
* true
|
||||
* XMLSchemas referenced by an XML file are cached in order to be reused by other parse operations
|
||||
* false (default)
|
||||
* XMLSchemas loaded during a parse operation will be discarded before the next one
|
||||
*
|
||||
* "http://apache.org/xml/features/validation/use-cachedGrammarInParse"
|
||||
* true
|
||||
* During this parse operation, reuse the XMLSchemas found in the cache
|
||||
* false (default)
|
||||
* Don't reuse the XMLSchemas found in the cache
|
||||
*
|
||||
* "http://apache.org/xml/features/calculate-src-ofs"
|
||||
* true
|
||||
* During parsing update the position in the source stream
|
||||
* false (default)
|
||||
* Don't waste time computing the position in the source stream
|
||||
*
|
||||
* "http://apache.org/xml/features/standard-uri-conformant"
|
||||
* true
|
||||
* Require that every URL being resolved is made of valid URL characters only
|
||||
* false (default)
|
||||
* Allow invalid URL characters in URL (e.g. spaces)
|
||||
*
|
||||
* "http://apache.org/xml/features/dom-has-psvi-info"
|
||||
* true
|
||||
* Add schema informations to DOMElement and DOMAttr nodes in the output DOM tree
|
||||
* false (default)
|
||||
* Don't store schema informations in the output DOM tree
|
||||
*
|
||||
* "http://apache.org/xml/features/generate-synthetic-annotations"
|
||||
* true
|
||||
* Create annotation objects in the representation of the loaded XMLSchemas
|
||||
* false (default)
|
||||
* Discard annotations found in the loaded XMLSchemas
|
||||
*
|
||||
* "http://apache.org/xml/features/validate-annotations"
|
||||
* true
|
||||
* Check that annotations are valid according to their XMLSchema definition
|
||||
* false (default)
|
||||
* Don't validate annotations
|
||||
*
|
||||
* "http://apache.org/xml/features/validation/identity-constraint-checking"
|
||||
* true (default)
|
||||
* Enforce identity constraints specified in the XMLSchema
|
||||
* false
|
||||
* Don't enforce identity constraints
|
||||
*
|
||||
* "http://apache.org/xml/features/validation/ignoreCachedDTD"
|
||||
* true
|
||||
* Don't reuse DTDs found in the cache, even if use-cachedGrammarInParse is <code>true</code>
|
||||
* false (default)
|
||||
* Reuse DTDs found in the cache, if use-cachedGrammarInParse is <code>true</code>
|
||||
*
|
||||
* "http://apache.org/xml/features/schema/ignore-annotations"
|
||||
* true
|
||||
* Don't process annotations found in an XMLSchema
|
||||
* false (default)
|
||||
* Process the annotations found in an XMLSchema
|
||||
*
|
||||
* "http://apache.org/xml/features/disable-default-entity-resolution"
|
||||
* true
|
||||
* Entities will be resolved only by a resolver installed by the user
|
||||
* false (default)
|
||||
* If the entity resolver has not been installed, or it refuses to resolve the given entity, the
|
||||
* parser will try to locate it himself
|
||||
*
|
||||
* "http://apache.org/xml/features/validation/schema/skip-dtd-validation"
|
||||
* true
|
||||
* If XMLSchema validation is <code>true</code>, DTD validation will not be performed
|
||||
* false (default)
|
||||
* If a DTD is found, it will be used to validate the XML
|
||||
*
|
||||
* @return The pointer to the configuration object.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMConfiguration* getDomConfig() = 0;
|
||||
|
||||
/**
|
||||
* Get a const pointer to the application filter
|
||||
*
|
||||
* This method returns the installed application filter. If no filter
|
||||
* has been installed, then it will be a zero pointer.
|
||||
*
|
||||
* @return A const pointer to the installed application filter
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const DOMLSParserFilter* getFilter() const = 0;
|
||||
|
||||
/**
|
||||
* Return whether the parser is asynchronous
|
||||
*
|
||||
* @return <code>true</code> if the <code>DOMLSParser</code> is asynchronous,
|
||||
* <code>false</code> if it is synchronous
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual bool getAsync() const = 0;
|
||||
|
||||
/**
|
||||
* Return whether the parser is busy parsing
|
||||
*
|
||||
* @return <code>true</code> if the <code>DOMLSParser</code> is currently busy
|
||||
* loading a document, otherwise <code>false</code>.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual bool getBusy() const = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Set the application filter
|
||||
*
|
||||
* When the application provides a filter, the parser will call out to
|
||||
* the filter at the completion of the construction of each <code>DOMElement</code>
|
||||
* node. The filter implementation can choose to remove the element from the
|
||||
* document being constructed or to terminate the parse early.
|
||||
* The filter is invoked after the operations requested by the DOMConfiguration
|
||||
* parameters have been applied. For example, if "validate" is set to true,
|
||||
* the validation is done before invoking the filter.
|
||||
*
|
||||
* <i>Any previously set filter is merely dropped, since the parser
|
||||
* does not own them.</i>
|
||||
*
|
||||
* @param filter A const pointer to the user supplied application
|
||||
* filter.
|
||||
*
|
||||
* @see #getFilter
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setFilter(DOMLSParserFilter* const filter) = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Parsing methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Parse an XML document from a resource identified by a <code>DOMLSInput</code>.
|
||||
*
|
||||
* The parser owns the returned DOMDocument. It will be deleted
|
||||
* when the parser is released.
|
||||
*
|
||||
* @param source The <code>DOMLSInput</code> from which the source of the document
|
||||
* is to be read.
|
||||
* @return If the <code>DOMLSParser</code> is a synchronous <code>DOMLSParser</code>
|
||||
* the newly created and populated <code>DOMDocument</code> is returned.
|
||||
* If the <code>DOMLSParser</code> is asynchronous then <code>NULL</code>
|
||||
* is returned since the document object may not yet be constructed when
|
||||
* this method returns.
|
||||
* @exception DOMException INVALID_STATE_ERR: Raised if the <code>DOMLSParser::busy</code>
|
||||
* attribute is true.
|
||||
* @exception DOMLSException PARSE_ERR: Starting from Xerces-C++ 4.0.0 this exception is
|
||||
* raised if the <code>DOMLSParser</code> was unable
|
||||
* to load the XML document. DOM applications should
|
||||
* attach a <code>DOMErrorHandler</code> using the
|
||||
* parameter "error-handler" if they wish to get details
|
||||
* on the error.
|
||||
*
|
||||
* @see DOMLSInput#DOMLSInput
|
||||
* @see DOMConfiguration
|
||||
* @see resetDocumentPool
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMDocument* parse(const DOMLSInput* source) = 0;
|
||||
|
||||
/**
|
||||
* Parse an XML document from a location identified by a URI reference [IETF RFC 2396].
|
||||
* If the URI contains a fragment identifier (see section 4.1 in [IETF RFC 2396]),
|
||||
* the behavior is not defined by this specification, future versions of this
|
||||
* specification may define the behavior.
|
||||
*
|
||||
* The parser owns the returned DOMDocument. It will be deleted
|
||||
* when the parser is released.
|
||||
*
|
||||
* @param uri The location of the XML document to be read (in Unicode)
|
||||
* @return If the <code>DOMLSParser</code> is a synchronous <code>DOMLSParser</code>
|
||||
* the newly created and populated <code>DOMDocument</code> is returned.
|
||||
* If the <code>DOMLSParser</code> is asynchronous then <code>NULL</code>
|
||||
* is returned since the document object is not yet parsed when this method returns.
|
||||
* @exception DOMException INVALID_STATE_ERR: Raised if the <code>DOMLSParser::busy</code>
|
||||
* attribute is true.
|
||||
* @exception DOMLSException PARSE_ERR: Starting from Xerces-C++ 4.0.0 this exception is
|
||||
* raised if the <code>DOMLSParser</code> was unable
|
||||
* to load the XML document. DOM applications should
|
||||
* attach a <code>DOMErrorHandler</code> using the
|
||||
* parameter "error-handler" if they wish to get details
|
||||
* on the error.
|
||||
*
|
||||
* @see #parse(DOMLSInput,...)
|
||||
* @see resetDocumentPool
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMDocument* parseURI(const XMLCh* const uri) = 0;
|
||||
|
||||
/**
|
||||
* Parse an XML document from a location identified by a URI reference [IETF RFC 2396].
|
||||
* If the URI contains a fragment identifier (see section 4.1 in [IETF RFC 2396]),
|
||||
* the behavior is not defined by this specification, future versions of this
|
||||
* specification may define the behavior.
|
||||
*
|
||||
* The parser owns the returned DOMDocument. It will be deleted
|
||||
* when the parser is released.
|
||||
*
|
||||
* @param uri The location of the XML document to be read (in the local code page)
|
||||
* @return If the <code>DOMLSParser</code> is a synchronous <code>DOMLSParser</code>
|
||||
* the newly created and populated <code>DOMDocument</code> is returned.
|
||||
* If the <code>DOMLSParser</code> is asynchronous then <code>NULL</code>
|
||||
* is returned since the document object is not yet parsed when this method returns.
|
||||
* @exception DOMException INVALID_STATE_ERR: Raised if the <code>DOMLSParser::busy</code>
|
||||
* attribute is true.
|
||||
* @exception DOMLSException PARSE_ERR: Starting from Xerces-C++ 4.0.0 this exception is
|
||||
* raised if the <code>DOMLSParser</code> was unable
|
||||
* to load the XML document. DOM applications should
|
||||
* attach a <code>DOMErrorHandler</code> using the
|
||||
* parameter "error-handler" if they wish to get details
|
||||
* on the error.
|
||||
*
|
||||
* @see #parse(DOMLSInput,...)
|
||||
* @see resetDocumentPool
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMDocument* parseURI(const char* const uri) = 0;
|
||||
|
||||
/**
|
||||
* Parse an XML fragment from a resource identified by a <code>DOMLSInput</code>
|
||||
* and insert the content into an existing document at the position specified
|
||||
* with the context and action arguments. When parsing the input stream, the
|
||||
* context node (or its parent, depending on where the result will be inserted)
|
||||
* is used for resolving unbound namespace prefixes. The context node's
|
||||
* <code>ownerDocument</code> node (or the node itself if the node of type
|
||||
* <code>DOCUMENT_NODE</code>) is used to resolve default attributes and entity
|
||||
* references.
|
||||
* As the new data is inserted into the document, at least one mutation event
|
||||
* is fired per new immediate child or sibling of the context node.
|
||||
* If the context node is a <code>DOMDocument</code> node and the action is
|
||||
* <code>ACTION_REPLACE_CHILDREN</code>, then the document that is passed as
|
||||
* the context node will be changed such that its <code>xmlEncoding</code>,
|
||||
* <code>documentURI</code>, <code>xmlVersion</code>, <code>inputEncoding</code>,
|
||||
* <code>xmlStandalone</code>, and all other such attributes are set to what they
|
||||
* would be set to if the input source was parsed using <code>DOMLSParser::parse()</code>.
|
||||
* This method is always synchronous, even if the <code>DOMLSParser</code> is
|
||||
* asynchronous (<code>DOMLSParser::getAsync()</code> returns true).
|
||||
* If an error occurs while parsing, the caller is notified through the <code>ErrorHandler</code>
|
||||
* instance associated with the "error-handler" parameter of the <code>DOMConfiguration</code>.
|
||||
* When calling <code>parseWithContext</code>, the values of the following configuration
|
||||
* parameters will be ignored and their default values will always be used instead:
|
||||
* "validate",
|
||||
* "validate-if-schema"
|
||||
* "element-content-whitespace".
|
||||
* Other parameters will be treated normally, and the parser is expected to call
|
||||
* the <code>DOMLSParserFilter</code> just as if a whole document was parsed.
|
||||
*
|
||||
* @param source The <code>DOMLSInput</code> from which the source document is
|
||||
* to be read. The source document must be an XML fragment, i.e.
|
||||
* anything except a complete XML document (except in the case where
|
||||
* the context node of type <code>DOCUMENT_NODE</code>, and the action is
|
||||
* <code>ACTION_REPLACE_CHILDREN</code>), a <code>DOCTYPE</code>
|
||||
* (internal subset), entity declaration(s), notation declaration(s),
|
||||
* or XML or text declaration(s).
|
||||
* @param contextNode The node that is used as the context for the data that is being
|
||||
* parsed. This node must be a <code>DOMDocument</code> node, a
|
||||
* <code>DOMDocumentFragment</code> node, or a node of a type that
|
||||
* is allowed as a child of an <code>DOMElement</code> node, e.g.
|
||||
* it cannot be an <code>DOMAttribute</code> node.
|
||||
* @param action This parameter describes which action should be taken between the new
|
||||
* set of nodes being inserted and the existing children of the context node.
|
||||
* The set of possible actions is defined in <code>ACTION_TYPES</code> above.
|
||||
* @return Return the node that is the result of the parse operation. If the result is more
|
||||
* than one top-level node, the first one is returned.
|
||||
*
|
||||
* @exception DOMException
|
||||
* HIERARCHY_REQUEST_ERR: Raised if the content cannot replace, be inserted before, after,
|
||||
* or as a child of the context node (see also <code>DOMNode::insertBefore</code>
|
||||
* or <code>DOMNode::replaceChild</code> in [DOM Level 3 Core]).
|
||||
* NOT_SUPPORTED_ERR: Raised if the <code>DOMLSParser</code> doesn't support this method,
|
||||
* or if the context node is of type <code>DOMDocument</code> and the DOM
|
||||
* implementation doesn't support the replacement of the <code>DOMDocumentType</code>
|
||||
* child or <code>DOMElement</code> child.
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if the context node is a read only node and the content
|
||||
* is being appended to its child list, or if the parent node of
|
||||
* the context node is read only node and the content is being
|
||||
* inserted in its child list.
|
||||
* INVALID_STATE_ERR: Raised if the <code>DOMLSParser::getBusy()</code> returns true.
|
||||
*
|
||||
* @exception DOMLSException PARSE_ERR: Raised if the <code>DOMLSParser</code> was unable to load
|
||||
* the XML fragment. DOM applications should attach a
|
||||
* <code>DOMErrorHandler</code> using the parameter "error-handler"
|
||||
* if they wish to get details on the error.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMNode* parseWithContext(const DOMLSInput* source, DOMNode* contextNode, const ActionType action) = 0;
|
||||
|
||||
/**
|
||||
* Abort the loading of the document that is currently being loaded by the <code>DOMLSParser</code>.
|
||||
* If the <code>DOMLSParser</code> is currently not busy, a call to this method does nothing.
|
||||
*
|
||||
* Note: invoking this method will remove the installed <code>DOMLSParserFilter</code> filter
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void abort() = 0;
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard Extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard Extension */
|
||||
//@{
|
||||
/**
|
||||
* Called to indicate that this DOMLSParser is no longer in use
|
||||
* and that the implementation may relinquish any resources associated with it.
|
||||
*
|
||||
* Access to a released object will lead to unexpected result.
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
|
||||
/** Reset the documents vector pool and release all the associated memory
|
||||
* back to the system.
|
||||
*
|
||||
* When parsing a document using a DOM parser, all memory allocated
|
||||
* for a DOM tree is associated to the DOM document.
|
||||
*
|
||||
* If you do multiple parse using the same DOM parser instance, then
|
||||
* multiple DOM documents will be generated and saved in a vector pool.
|
||||
* All these documents (and thus all the allocated memory)
|
||||
* won't be deleted until the parser instance is destroyed.
|
||||
*
|
||||
* If you don't need these DOM documents anymore and don't want to
|
||||
* destroy the DOM parser instance at this moment, then you can call this method
|
||||
* to reset the document vector pool and release all the allocated memory
|
||||
* back to the system.
|
||||
*
|
||||
* It is an error to call this method if you are in the middle of a
|
||||
* parse (e.g. in the mid of a progressive parse).
|
||||
*
|
||||
* @exception IOException An exception from the parser if this function
|
||||
* is called when a parse is in progress.
|
||||
*
|
||||
*/
|
||||
virtual void resetDocumentPool() = 0;
|
||||
|
||||
/**
|
||||
* Preparse schema grammar (XML Schema, DTD, etc.) via an input source
|
||||
* object.
|
||||
*
|
||||
* This method invokes the preparsing process on a schema grammar XML
|
||||
* file specified by the DOMLSInput parameter. If the 'toCache' flag
|
||||
* is enabled, the parser will cache the grammars for re-use. If a grammar
|
||||
* key is found in the pool, no caching of any grammar will take place.
|
||||
*
|
||||
* @param source A const reference to the DOMLSInput object which
|
||||
* points to the schema grammar file to be preparsed.
|
||||
* @param grammarType The grammar type (Schema or DTD).
|
||||
* @param toCache If <code>true</code>, we cache the preparsed grammar,
|
||||
* otherwise, no chaching. Default is <code>false</code>.
|
||||
* @return The preparsed schema grammar object (SchemaGrammar or
|
||||
* DTDGrammar). That grammar object is owned by the parser.
|
||||
*
|
||||
* @exception SAXException Any SAX exception, possibly
|
||||
* wrapping another exception.
|
||||
* @exception XMLException An exception from the parser or client
|
||||
* handler code.
|
||||
* @exception DOMException A DOM exception as per DOM spec.
|
||||
*
|
||||
* @see DOMLSInput#DOMLSInput
|
||||
*/
|
||||
virtual Grammar* loadGrammar(const DOMLSInput* source,
|
||||
const Grammar::GrammarType grammarType,
|
||||
const bool toCache = false) = 0;
|
||||
|
||||
/**
|
||||
* Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL
|
||||
*
|
||||
* This method invokes the preparsing process on a schema grammar XML
|
||||
* file specified by the file path parameter. If the 'toCache' flag is
|
||||
* enabled, the parser will cache the grammars for re-use. If a grammar
|
||||
* key is found in the pool, no caching of any grammar will take place.
|
||||
*
|
||||
* @param systemId A const XMLCh pointer to the Unicode string which
|
||||
* contains the path to the XML grammar file to be
|
||||
* preparsed.
|
||||
* @param grammarType The grammar type (Schema or DTD).
|
||||
* @param toCache If <code>true</code>, we cache the preparsed grammar,
|
||||
* otherwise, no chaching. Default is <code>false</code>.
|
||||
* @return The preparsed schema grammar object (SchemaGrammar or
|
||||
* DTDGrammar). That grammar object is owned by the parser.
|
||||
*
|
||||
* @exception SAXException Any SAX exception, possibly
|
||||
* wrapping another exception.
|
||||
* @exception XMLException An exception from the parser or client
|
||||
* handler code.
|
||||
* @exception DOMException A DOM exception as per DOM spec.
|
||||
*/
|
||||
virtual Grammar* loadGrammar(const XMLCh* const systemId,
|
||||
const Grammar::GrammarType grammarType,
|
||||
const bool toCache = false) = 0;
|
||||
|
||||
/**
|
||||
* Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL
|
||||
*
|
||||
* This method invokes the preparsing process on a schema grammar XML
|
||||
* file specified by the file path parameter. If the 'toCache' flag is
|
||||
* enabled, the parser will cache the grammars for re-use. If a grammar
|
||||
* key is found in the pool, no caching of any grammar will take place.
|
||||
*
|
||||
* @param systemId A const char pointer to a native string which contains
|
||||
* the path to the XML grammar file to be preparsed.
|
||||
* @param grammarType The grammar type (Schema or DTD).
|
||||
* @param toCache If <code>true</code>, we cache the preparsed grammar,
|
||||
* otherwise, no chaching. Default is <code>false</code>.
|
||||
* @return The preparsed schema grammar object (SchemaGrammar or
|
||||
* DTDGrammar). That grammar object is owned by the parser.
|
||||
*
|
||||
*
|
||||
* @exception SAXException Any SAX exception, possibly
|
||||
* wrapping another exception.
|
||||
* @exception XMLException An exception from the parser or client
|
||||
* handler code.
|
||||
* @exception DOMException A DOM exception as per DOM spec.
|
||||
*/
|
||||
virtual Grammar* loadGrammar(const char* const systemId,
|
||||
const Grammar::GrammarType grammarType,
|
||||
const bool toCache = false) = 0;
|
||||
|
||||
/**
|
||||
* Retrieve the grammar that is associated with the specified namespace key
|
||||
*
|
||||
* @param nameSpaceKey Namespace key
|
||||
* @return Grammar associated with the Namespace key.
|
||||
*/
|
||||
virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey) const = 0;
|
||||
|
||||
/**
|
||||
* Retrieve the grammar where the root element is declared.
|
||||
*
|
||||
* @return Grammar where root element declared
|
||||
*/
|
||||
virtual Grammar* getRootGrammar() const = 0;
|
||||
|
||||
/**
|
||||
* Returns the string corresponding to a URI id from the URI string pool.
|
||||
*
|
||||
* @param uriId id of the string in the URI string pool.
|
||||
* @return URI string corresponding to the URI id.
|
||||
*/
|
||||
virtual const XMLCh* getURIText(unsigned int uriId) const = 0;
|
||||
|
||||
/**
|
||||
* Clear the cached grammar pool
|
||||
*/
|
||||
virtual void resetCachedGrammarPool() = 0;
|
||||
|
||||
/**
|
||||
* Returns the current src offset within the input source.
|
||||
*
|
||||
* @return offset within the input source
|
||||
*/
|
||||
virtual XMLFilePos getSrcOffset() const = 0;
|
||||
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMLSParserFilter.hpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMLSPARSERFILTER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMLSPARSERFILTER_HPP
|
||||
|
||||
/**
|
||||
*
|
||||
* DOMLSParserFilter.hpp: interface for the DOMLSParserFilter class.
|
||||
*
|
||||
* DOMLSParserFilter provide applications the ability to examine nodes
|
||||
* as they are being created during the parse process.
|
||||
*
|
||||
* DOMLSParserFilter lets the application decide what nodes should be
|
||||
* in the output DOM tree or not.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
|
||||
#include <xercesc/dom/DOMNodeFilter.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMElement;
|
||||
class DOMNode;
|
||||
|
||||
class CDOM_EXPORT DOMLSParserFilter {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMLSParserFilter() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMLSParserFilter(const DOMLSParserFilter &);
|
||||
DOMLSParserFilter & operator = (const DOMLSParserFilter &);
|
||||
//@}
|
||||
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMLSParserFilter() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Class Types
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Public Contants */
|
||||
//@{
|
||||
/**
|
||||
* Constants returned by acceptNode.
|
||||
*
|
||||
* <p><code>FILTER_ACCEPT:</code>
|
||||
* Accept the node.</p>
|
||||
*
|
||||
* <p><code>FILTER_REJECT:</code>
|
||||
* Reject the node and its children.</p>
|
||||
*
|
||||
* <p><code>FILTER_SKIP:</code>
|
||||
* Skip this single node. The children of this node will still be considered.</p>
|
||||
*
|
||||
* <p><code>FILTER_INTERRUPT:</code>
|
||||
* Interrupt the normal processing of the document.</p>
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
enum FilterAction {FILTER_ACCEPT = 1,
|
||||
FILTER_REJECT = 2,
|
||||
FILTER_SKIP = 3,
|
||||
FILTER_INTERRUPT = 4};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMLSParserFilter interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
/**
|
||||
* This method will be called by the parser at the completion of the parsing of each node.
|
||||
* The node and all of its descendants will exist and be complete. The parent node will also exist,
|
||||
* although it may be incomplete, i.e. it may have additional children that have not yet been parsed.
|
||||
* Attribute nodes are never passed to this function.
|
||||
* From within this method, the new node may be freely modified - children may be added or removed,
|
||||
* text nodes modified, etc. The state of the rest of the document outside this node is not defined,
|
||||
* and the affect of any attempt to navigate to, or to modify any other part of the document is undefined.
|
||||
* For validating parsers, the checks are made on the original document, before any modification by the
|
||||
* filter. No validity checks are made on any document modifications made by the filter.
|
||||
* If this new node is rejected, the parser might reuse the new node and any of its descendants.
|
||||
*
|
||||
* @param node The newly constructed element. At the time this method is called, the element is complete -
|
||||
* it has all of its children (and their children, recursively) and attributes, and is attached
|
||||
* as a child to its parent.
|
||||
* @return One of the FilterAction enum
|
||||
*/
|
||||
virtual FilterAction acceptNode(DOMNode* node) = 0;
|
||||
|
||||
/**
|
||||
* The parser will call this method after each <code>DOMElement</code> start tag has been scanned,
|
||||
* but before the remainder of the <code>DOMElement</code> is processed. The intent is to allow the element,
|
||||
* including any children, to be efficiently skipped. Note that only element nodes are passed to the
|
||||
* startElement function.
|
||||
* The element node passed to startElement for filtering will include all of the attributes, but none
|
||||
* of the children nodes. The <code>DOMElement</code> may not yet be in place in the document being
|
||||
* constructed (it may not have a parent node.)
|
||||
* A startElement filter function may access or change the attributes for the <code>DOMElement</code>.
|
||||
* Changing namespace declarations will have no effect on namespace resolution by the parser.
|
||||
*
|
||||
* @param node The newly encountered element. At the time this method is called, the element is incomplete -
|
||||
* it will have its attributes, but no children.
|
||||
* @return One of the FilterAction enum
|
||||
*/
|
||||
virtual FilterAction startElement(DOMElement* node) = 0;
|
||||
|
||||
/**
|
||||
* Tells the <code>DOMLSParser</code> what types of nodes to show to the method <code>DOMLSParserFilter::acceptNode</code>.
|
||||
* If a node is not shown to the filter using this attribute, it is automatically included in the DOM document being built.
|
||||
* See <code>DOMNodeFilter</code> for definition of the constants. The constants SHOW_ATTRIBUTE, SHOW_DOCUMENT,
|
||||
* SHOW_DOCUMENT_TYPE, SHOW_NOTATION, SHOW_ENTITY, and SHOW_DOCUMENT_FRAGMENT are meaningless here.
|
||||
* Those nodes will never be passed to DOMLSParserFilter::acceptNode.
|
||||
*
|
||||
* @return The constants of what types of nodes to show.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMNodeFilter::ShowType getWhatToShow() const = 0;
|
||||
|
||||
//@}
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMLSResourceResolver.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMLSRESOURCERESOLVER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMLSRESOURCERESOLVER_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMLSInput;
|
||||
|
||||
/**
|
||||
* DOMLSResourceResolver provides a way for applications to redirect references
|
||||
* to external entities.
|
||||
*
|
||||
* <p>Applications needing to implement customized handling for external
|
||||
* entities must implement this interface and register their implementation
|
||||
* by setting the entityResolver attribute of the DOMLSParser.</p>
|
||||
*
|
||||
* <p>The DOMLSParser will then allow the application to intercept any
|
||||
* external entities (including the external DTD subset and external parameter
|
||||
* entities) before including them.</p>
|
||||
*
|
||||
* <p>Many DOM applications will not need to implement this interface, but it
|
||||
* will be especially useful for applications that build XML documents from
|
||||
* databases or other specialized input sources, or for applications that use
|
||||
* URNs.</p>
|
||||
*
|
||||
* @see DOMLSParser#getDomConfig
|
||||
* @see DOMLSInput#DOMLSInput
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
class CDOM_EXPORT DOMLSResourceResolver
|
||||
{
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMLSResourceResolver() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMLSResourceResolver(const DOMLSResourceResolver &);
|
||||
DOMLSResourceResolver & operator = (const DOMLSResourceResolver &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMLSResourceResolver() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMLSResourceResolver interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
/**
|
||||
* Allow the application to resolve external resources.
|
||||
*
|
||||
* The <code>DOMLSParser</code> will call this method before opening any external resource,
|
||||
* including the external DTD subset, external entities referenced within the DTD, and
|
||||
* external entities referenced within the document element (however, the top-level
|
||||
* document entity is not passed to this method). The application may then request that
|
||||
* the <code>DOMLSParser</code> resolve the external resource itself, that it use an
|
||||
* alternative URI, or that it use an entirely different input source.
|
||||
*
|
||||
* Application writers can use this method to redirect external system identifiers to
|
||||
* secure and/or local URI, to look up public identifiers in a catalogue, or to read
|
||||
* an entity from a database or other input source (including, for example, a dialog box).
|
||||
*
|
||||
* The returned DOMLSInput is owned by the DOMLSParser which is
|
||||
* responsible to clean up the memory.
|
||||
*
|
||||
* @param resourceType The type of the resource being resolved. For XML [XML 1.0] resources
|
||||
* (i.e. entities), applications must use the value "http://www.w3.org/TR/REC-xml".
|
||||
* For XML Schema [XML Schema Part 1], applications must use the value
|
||||
* "http://www.w3.org/2001/XMLSchema". Other types of resources are outside
|
||||
* the scope of this specification and therefore should recommend an absolute
|
||||
* URI in order to use this method.
|
||||
* @param namespaceUri The namespace of the resource being resolved, e.g. the target namespace
|
||||
* of the XML Schema [XML Schema Part 1] when resolving XML Schema resources.
|
||||
* @param publicId The public identifier of the external entity being referenced, or <code>null</code>
|
||||
* if no public identifier was supplied or if the resource is not an entity.
|
||||
* @param systemId The system identifier, a URI reference [IETF RFC 2396], of the external
|
||||
* resource being referenced, or <code>null</code> if no system identifier was supplied.
|
||||
* @param baseURI The absolute base URI of the resource being parsed, or <code>null</code> if
|
||||
* there is no base URI.
|
||||
* @return A DOMLSInput object describing the new input source,
|
||||
* or <code>null</code> to request that the parser open a regular
|
||||
* URI connection to the resource.
|
||||
* The returned DOMLSInput is owned by the DOMLSParser which is
|
||||
* responsible to clean up the memory.
|
||||
* @see DOMLSInput#DOMLSInput
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMLSInput* resolveResource( const XMLCh* const resourceType
|
||||
, const XMLCh* const namespaceUri
|
||||
, const XMLCh* const publicId
|
||||
, const XMLCh* const systemId
|
||||
, const XMLCh* const baseURI) = 0;
|
||||
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,547 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMLSSerializer.hpp 883665 2009-11-24 11:41:38Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMLSSERIALIZER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMLSSERIALIZER_HPP
|
||||
|
||||
/**
|
||||
*
|
||||
* DOMLSSerializer provides an API for serializing (writing) a DOM document out in
|
||||
* an XML document. The XML data is written to an output stream, the type of
|
||||
* which depends on the specific language bindings in use. During
|
||||
* serialization of XML data, namespace fixup is done when possible.
|
||||
* <p> <code>DOMLSSerializer</code> accepts any node type for serialization. For
|
||||
* nodes of type <code>Document</code> or <code>Entity</code>, well formed
|
||||
* XML will be created if possible. The serialized output for these node
|
||||
* types is either as a Document or an External Entity, respectively, and is
|
||||
* acceptable input for an XML parser. For all other types of nodes the
|
||||
* serialized form is not specified, but should be something useful to a
|
||||
* human for debugging or diagnostic purposes. Note: rigorously designing an
|
||||
* external (source) form for stand-alone node types that don't already have
|
||||
* one defined in seems a bit much to take on here.
|
||||
* <p>Within a Document or Entity being serialized, Nodes are processed as
|
||||
* follows Documents are written including an XML declaration and a DTD
|
||||
* subset, if one exists in the DOM. Writing a document node serializes the
|
||||
* entire document. Entity nodes, when written directly by
|
||||
* <code>write</code> defined in the <code>DOMLSSerializer</code> interface,
|
||||
* output the entity expansion but no namespace fixup is done. The resulting
|
||||
* output will be valid as an external entity. Entity References nodes are
|
||||
* serializes as an entity reference of the form
|
||||
* <code>"&entityName;"</code>) in the output. Child nodes (the
|
||||
* expansion) of the entity reference are ignored. CDATA sections
|
||||
* containing content characters that can not be represented in the
|
||||
* specified output encoding are handled according to the
|
||||
* "split-cdata-sections" feature.If the feature is <code>true</code>, CDATA
|
||||
* sections are split, and the unrepresentable characters are serialized as
|
||||
* numeric character references in ordinary content. The exact position and
|
||||
* number of splits is not specified. If the feature is <code>false</code>,
|
||||
* unrepresentable characters in a CDATA section are reported as errors. The
|
||||
* error is not recoverable - there is no mechanism for supplying
|
||||
* alternative characters and continuing with the serialization. All other
|
||||
* node types (DOMElement, DOMText, etc.) are serialized to their corresponding
|
||||
* XML source form.
|
||||
* <p> Within the character data of a document (outside of markup), any
|
||||
* characters that cannot be represented directly are replaced with
|
||||
* character references. Occurrences of '<' and '&' are replaced by
|
||||
* the predefined entities &lt; and &amp. The other predefined
|
||||
* entities (&gt, &apos, etc.) are not used; these characters can be
|
||||
* included directly. Any character that can not be represented directly in
|
||||
* the output character encoding is serialized as a numeric character
|
||||
* reference.
|
||||
* <p> Attributes not containing quotes are serialized in quotes. Attributes
|
||||
* containing quotes but no apostrophes are serialized in apostrophes
|
||||
* (single quotes). Attributes containing both forms of quotes are
|
||||
* serialized in quotes, with quotes within the value represented by the
|
||||
* predefined entity &quot;. Any character that can not be represented
|
||||
* directly in the output character encoding is serialized as a numeric
|
||||
* character reference.
|
||||
* <p> Within markup, but outside of attributes, any occurrence of a character
|
||||
* that cannot be represented in the output character encoding is reported
|
||||
* as an error. An example would be serializing the element
|
||||
* <LaCañada/> with the encoding="us-ascii".
|
||||
* <p> When requested by setting the <code>normalize-characters</code> feature
|
||||
* on <code>DOMLSSerializer</code>, all data to be serialized, both markup and
|
||||
* character data, is W3C Text normalized according to the rules defined in
|
||||
* . The W3C Text normalization process affects only the data as it is being
|
||||
* written; it does not alter the DOM's view of the document after
|
||||
* serialization has completed.
|
||||
* <p>Namespaces are fixed up during serialization, the serialization process
|
||||
* will verify that namespace declarations, namespace prefixes and the
|
||||
* namespace URIs associated with Elements and Attributes are consistent. If
|
||||
* inconsistencies are found, the serialized form of the document will be
|
||||
* altered to remove them. The algorithm used for doing the namespace fixup
|
||||
* while seralizing a document is a combination of the algorithms used for
|
||||
* lookupNamespaceURI and lookupPrefix. previous paragraph to be
|
||||
* defined closer here.
|
||||
* <p>Any changes made affect only the namespace prefixes and declarations
|
||||
* appearing in the serialized data. The DOM's view of the document is not
|
||||
* altered by the serialization operation, and does not reflect any changes
|
||||
* made to namespace declarations or prefixes in the serialized output.
|
||||
* <p> While serializing a document the serializer will write out
|
||||
* non-specified values (such as attributes whose <code>specified</code> is
|
||||
* <code>false</code>) if the <code>output-default-values</code> feature is
|
||||
* set to <code>true</code>. If the <code>output-default-values</code> flag
|
||||
* is set to <code>false</code> and the <code>use-abstract-schema</code>
|
||||
* feature is set to <code>true</code> the abstract schema will be used to
|
||||
* determine if a value is specified or not, if
|
||||
* <code>use-abstract-schema</code> is not set the <code>specified</code>
|
||||
* flag on attribute nodes is used to determine if attribute values should
|
||||
* be written out.
|
||||
* <p> Ref to Core spec (1.1.9, XML namespaces, 5th paragraph) entity ref
|
||||
* description about warning about unbound entity refs. Entity refs are
|
||||
* always serialized as &foo;, also mention this in the load part of
|
||||
* this spec.
|
||||
* <p> When serializing a document the DOMLSSerializer checks to see if the document
|
||||
* element in the document is a DOM Level 1 element or a DOM Level 2 (or
|
||||
* higher) element (this check is done by looking at the localName of the
|
||||
* root element). If the root element is a DOM Level 1 element then the
|
||||
* DOMLSSerializer will issue an error if a DOM Level 2 (or higher) element is
|
||||
* found while serializing. Likewise if the document element is a DOM Level
|
||||
* 2 (or higher) element and the DOMLSSerializer sees a DOM Level 1 element an
|
||||
* error is issued. Mixing DOM Level 1 elements with DOM Level 2 (or higher)
|
||||
* is not supported.
|
||||
* <p> <code>DOMLSSerializer</code>s have a number of named features that can be
|
||||
* queried or set. The name of <code>DOMLSSerializer</code> features must be valid
|
||||
* XML names. Implementation specific features (extensions) should choose an
|
||||
* implementation dependent prefix to avoid name collisions.
|
||||
* <p>Here is a list of properties that must be recognized by all
|
||||
* implementations.
|
||||
* <dl>
|
||||
* <dt><code>"normalize-characters"</code></dt>
|
||||
* <dd>
|
||||
* <dl>
|
||||
* <dt><code>true</code></dt>
|
||||
* <dd>[
|
||||
* optional] (default) Perform the W3C Text Normalization of the characters
|
||||
* in document as they are written out. Only the characters being written
|
||||
* are (potentially) altered. The DOM document itself is unchanged. </dd>
|
||||
* <dt>
|
||||
* <code>false</code></dt>
|
||||
* <dd>[required] do not perform character normalization. </dd>
|
||||
* </dl></dd>
|
||||
* <dt>
|
||||
* <code>"split-cdata-sections"</code></dt>
|
||||
* <dd>
|
||||
* <dl>
|
||||
* <dt><code>true</code></dt>
|
||||
* <dd>[required] (default)
|
||||
* Split CDATA sections containing the CDATA section termination marker
|
||||
* ']]>' or characters that can not be represented in the output
|
||||
* encoding, and output the characters using numeric character references.
|
||||
* If a CDATA section is split a warning is issued. </dd>
|
||||
* <dt><code>false</code></dt>
|
||||
* <dd>[
|
||||
* required] Signal an error if a <code>CDATASection</code> contains an
|
||||
* unrepresentable character. </dd>
|
||||
* </dl></dd>
|
||||
* <dt><code>"validation"</code></dt>
|
||||
* <dd>
|
||||
* <dl>
|
||||
* <dt><code>true</code></dt>
|
||||
* <dd>[
|
||||
* optional] Use the abstract schema to validate the document as it is being
|
||||
* serialized. If validation errors are found the error handler is notified
|
||||
* about the error. Setting this state will also set the feature
|
||||
* <code>use-abstract-schema</code> to <code>true</code>. </dd>
|
||||
* <dt><code>false</code></dt>
|
||||
* <dd>[
|
||||
* required] (default) Don't validate the document as it is being
|
||||
* serialized. </dd>
|
||||
* </dl></dd>
|
||||
* <dt><code>"expand-entity-references"</code></dt>
|
||||
* <dd>
|
||||
* <dl>
|
||||
* <dt><code>true</code></dt>
|
||||
* <dd>[
|
||||
* optional] Expand <code>EntityReference</code> nodes when serializing. </dd>
|
||||
* <dt>
|
||||
* <code>false</code></dt>
|
||||
* <dd>[required] (default) Serialize all
|
||||
* <code>EntityReference</code> nodes as XML entity references. </dd>
|
||||
* </dl></dd>
|
||||
* <dt>
|
||||
* <code>"whitespace-in-element-content"</code></dt>
|
||||
* <dd>
|
||||
* <dl>
|
||||
* <dt><code>true</code></dt>
|
||||
* <dd>[required] (
|
||||
* default) Output all white spaces in the document. </dd>
|
||||
* <dt><code>false</code></dt>
|
||||
* <dd>[
|
||||
* optional] Only output white space that is not within element content. The
|
||||
* implementation is expected to use the
|
||||
* <code>isWhitespaceInElementContent</code> flag on <code>Text</code> nodes
|
||||
* to determine if a text node should be written out or not. </dd>
|
||||
* </dl></dd>
|
||||
* <dt>
|
||||
* <code>"discard-default-content"</code></dt>
|
||||
* <dd>
|
||||
* <dl>
|
||||
* <dt><code>true</code></dt>
|
||||
* <dd>[required] (default
|
||||
* ) Use whatever information available to the implementation (i.e. XML
|
||||
* schema, DTD, the <code>specified</code> flag on <code>Attr</code> nodes,
|
||||
* and so on) to decide what attributes and content should be serialized or
|
||||
* not. Note that the <code>specified</code> flag on <code>Attr</code> nodes
|
||||
* in itself is not always reliable, it is only reliable when it is set to
|
||||
* <code>false</code> since the only case where it can be set to
|
||||
* <code>false</code> is if the attribute was created by a Level 1
|
||||
* implementation. </dd>
|
||||
* <dt><code>false</code></dt>
|
||||
* <dd>[required] Output all attributes and
|
||||
* all content. </dd>
|
||||
* </dl></dd>
|
||||
* <dt><code>"format-canonical"</code></dt>
|
||||
* <dd>
|
||||
* <dl>
|
||||
* <dt><code>true</code></dt>
|
||||
* <dd>[optional]
|
||||
* This formatting writes the document according to the rules specified in .
|
||||
* Setting this feature to true will set the feature "format-pretty-print"
|
||||
* to false. </dd>
|
||||
* <dt><code>false</code></dt>
|
||||
* <dd>[required] (default) Don't canonicalize the
|
||||
* output. </dd>
|
||||
* </dl></dd>
|
||||
* <dt><code>"format-pretty-print"</code></dt>
|
||||
* <dd>
|
||||
* <dl>
|
||||
* <dt><code>true</code></dt>
|
||||
* <dd>[optional]
|
||||
* Formatting the output by adding whitespace to produce a pretty-printed,
|
||||
* indented, human-readable form. The exact form of the transformations is
|
||||
* not specified by this specification. Setting this feature to true will
|
||||
* set the feature "format-canonical" to false. </dd>
|
||||
* <dt><code>false</code></dt>
|
||||
* <dd>[required]
|
||||
* (default) Don't pretty-print the result. </dd>
|
||||
* </dl></dd>
|
||||
* <dt><code>"http://apache.org/xml/features/dom/byte-order-mark"</code></dt>
|
||||
* <dd>
|
||||
* <dl>
|
||||
* <dt><code>false</code></dt>
|
||||
* <dd>[optional]
|
||||
* (default) Setting this feature to true will output the correct BOM for the specified
|
||||
* encoding. </dd>
|
||||
* <dt><code>true</code></dt>
|
||||
* <dd>[required]
|
||||
* Don't generate a BOM. </dd>
|
||||
* </dl></dd>
|
||||
* <dt><code>"http://apache.org/xml/features/pretty-print/space-first-level-elements"</code></dt>
|
||||
* <dd>
|
||||
* <dl>
|
||||
* <dt><code>true</code></dt>
|
||||
* <dd>[optional]
|
||||
* (default) Setting this feature to true will add an extra line feed between the elements
|
||||
* that are children of the document root. </dd>
|
||||
* <dt><code>false</code></dt>
|
||||
* <dd>[required]
|
||||
* Don't add the extra line feed. </dd>
|
||||
* </dl></dd>
|
||||
* </dl>
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407'>Document Object Model (DOM) Level 3 Load and Save Specification</a>.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
|
||||
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
#include <xercesc/dom/DOMLSSerializerFilter.hpp>
|
||||
#include <xercesc/dom/DOMErrorHandler.hpp>
|
||||
#include <xercesc/dom/DOMConfiguration.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMLSOutput;
|
||||
|
||||
class CDOM_EXPORT DOMLSSerializer
|
||||
{
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMLSSerializer() {};
|
||||
//@}
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMLSSerializer(const DOMLSSerializer &);
|
||||
DOMLSSerializer & operator = (const DOMLSSerializer &);
|
||||
//@}
|
||||
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMLSSerializer() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMLSSerializer interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Feature methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* The DOMConfiguration object used by the LSSerializer when serializing a DOM node.
|
||||
*
|
||||
* In addition to the parameters recognized in on the <code>DOMConfiguration</code>
|
||||
* interface defined in [DOM Level 3 Core], the <code>DOMConfiguration</code> objects
|
||||
* for <code>DOMLSSerializer</code> add or modify the following parameters:
|
||||
*
|
||||
* "canonical-form"
|
||||
* true [optional]
|
||||
* Writes the document according to the rules specified in [Canonical XML]. In addition to
|
||||
* the behavior described in "canonical-form" [DOM Level 3 Core], setting this parameter to
|
||||
* true will set the parameters "format-pretty-print", "discard-default-content", and
|
||||
* "xml-declaration", to false. Setting one of those parameters to true will set this
|
||||
* parameter to false. Serializing an XML 1.1 document when "canonical-form" is true will
|
||||
* generate a fatal error.
|
||||
* false [required] (default)
|
||||
* Do not canonicalize the output.
|
||||
*
|
||||
* "discard-default-content"
|
||||
* true [required] (default)
|
||||
* Use the DOMAttr::getSpecified attribute to decide what attributes should be discarded.
|
||||
* Note that some implementations might use whatever information available to the implementation
|
||||
* (i.e. XML schema, DTD, the DOMAttr::getSpecified attribute, and so on) to determine what
|
||||
* attributes and content to discard if this parameter is set to true.
|
||||
* false [required]
|
||||
* Keep all attributes and all content.
|
||||
*
|
||||
* "format-pretty-print"
|
||||
* true [optional]
|
||||
* Formatting the output by adding whitespace to produce a pretty-printed, indented,
|
||||
* human-readable form. The exact form of the transformations is not specified by this specification.
|
||||
* Pretty-printing changes the content of the document and may affect the validity of the document,
|
||||
* validating implementations should preserve validity.
|
||||
* false [required] (default)
|
||||
* Don't pretty-print the result.
|
||||
*
|
||||
* "ignore-unknown-character-denormalizations"
|
||||
* true [required] (default)
|
||||
* If, while verifying full normalization when [XML 1.1] is supported, a character is encountered
|
||||
* for which the normalization properties cannot be determined, then raise a "unknown-character-denormalization"
|
||||
* warning (instead of raising an error, if this parameter is not set) and ignore any possible
|
||||
* denormalizations caused by these characters.
|
||||
* false [optional]
|
||||
* Report a fatal error if a character is encountered for which the processor cannot determine the
|
||||
* normalization properties.
|
||||
*
|
||||
* "normalize-characters"
|
||||
* This parameter is equivalent to the one defined by <code>DOMConfiguration</code> in [DOM Level 3 Core].
|
||||
* Unlike in the Core, the default value for this parameter is true. While DOM implementations are not
|
||||
* required to support fully normalizing the characters in the document according to appendix E of [XML 1.1],
|
||||
* this parameter must be activated by default if supported.
|
||||
*
|
||||
* "xml-declaration"
|
||||
* true [required] (default)
|
||||
* If a DOMDocument, DOMElement, or DOMEntity node is serialized, the XML declaration, or text declaration,
|
||||
* should be included. The version (DOMDocument::xmlVersion if the document is a Level 3 document and the
|
||||
* version is non-null, otherwise use the value "1.0"), and the output encoding (see DOMLSSerializer::write
|
||||
* for details on how to find the output encoding) are specified in the serialized XML declaration.
|
||||
* false [required]
|
||||
* Do not serialize the XML and text declarations. Report a "xml-declaration-needed" warning if this will
|
||||
* cause problems (i.e. the serialized data is of an XML version other than [XML 1.0], or an encoding would
|
||||
* be needed to be able to re-parse the serialized data).
|
||||
*
|
||||
* "error-handler"
|
||||
* Contains a DOMErrorHandler object. If an error is encountered in the document, the implementation will call back
|
||||
* the DOMErrorHandler registered using this parameter. The implementation may provide a default DOMErrorHandler
|
||||
* object. When called, DOMError::relatedData will contain the closest node to where the error occurred.
|
||||
* If the implementation is unable to determine the node where the error occurs, DOMError::relatedData will contain
|
||||
* the DOMDocument node. Mutations to the document from within an error handler will result in implementation
|
||||
* dependent behavior.
|
||||
*
|
||||
* @return The pointer to the configuration object.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMConfiguration* getDomConfig() = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* The end-of-line sequence of characters to be used in the XML being
|
||||
* written out. The only permitted values are these:
|
||||
* <dl>
|
||||
* <dt><code>null</code></dt>
|
||||
* <dd>
|
||||
* Use a default end-of-line sequence. DOM implementations should choose
|
||||
* the default to match the usual convention for text files in the
|
||||
* environment being used. Implementations must choose a default
|
||||
* sequence that matches one of those allowed by 2.11 "End-of-Line
|
||||
* Handling". However, Xerces-C++ always uses LF when this
|
||||
* property is set to <code>null</code> since otherwise automatic
|
||||
* translation of LF to CR-LF on Windows for text files would
|
||||
* result in such files containing CR-CR-LF. If you need Windows-style
|
||||
* end of line sequences in your output, consider writing to a file
|
||||
* opened in text mode or explicitly set this property to CR-LF.</dd>
|
||||
* <dt>CR</dt>
|
||||
* <dd>The carriage-return character (\#xD).</dd>
|
||||
* <dt>CR-LF</dt>
|
||||
* <dd> The
|
||||
* carriage-return and line-feed characters (\#xD \#xA). </dd>
|
||||
* <dt>LF</dt>
|
||||
* <dd> The line-feed
|
||||
* character (\#xA). </dd>
|
||||
* </dl>
|
||||
* <br>The default value for this attribute is <code>null</code>.
|
||||
*
|
||||
* @param newLine The end-of-line sequence of characters to be used.
|
||||
* @see getNewLine
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setNewLine(const XMLCh* const newLine) = 0;
|
||||
|
||||
/**
|
||||
* When the application provides a filter, the serializer will call out
|
||||
* to the filter before serializing each Node. Attribute nodes are never
|
||||
* passed to the filter. The filter implementation can choose to remove
|
||||
* the node from the stream or to terminate the serialization early.
|
||||
*
|
||||
* @param filter The writer filter to be used.
|
||||
* @see getFilter
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setFilter(DOMLSSerializerFilter *filter) = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Return the end-of-line sequence of characters to be used in the XML being
|
||||
* written out.
|
||||
*
|
||||
* @return The end-of-line sequence of characters to be used.
|
||||
* @see setNewLine
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getNewLine() const = 0;
|
||||
|
||||
/**
|
||||
* Return the WriterFilter used.
|
||||
*
|
||||
* @return The writer filter used.
|
||||
* @see setFilter
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMLSSerializerFilter* getFilter() const = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Write methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Write out the specified node as described above in the description of
|
||||
* <code>DOMLSSerializer</code>. Writing a Document or Entity node produces a
|
||||
* serialized form that is well formed XML. Writing other node types
|
||||
* produces a fragment of text in a form that is not fully defined by
|
||||
* this document, but that should be useful to a human for debugging or
|
||||
* diagnostic purposes.
|
||||
*
|
||||
* @param nodeToWrite The <code>Document</code> or <code>Entity</code> node to
|
||||
* be written. For other node types, something sensible should be
|
||||
* written, but the exact serialized form is not specified.
|
||||
* @param destination The destination for the data to be written.
|
||||
* @return Returns <code>true</code> if <code>node</code> was
|
||||
* successfully serialized and <code>false</code> in case a failure
|
||||
* occured and the failure wasn't canceled by the error handler.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual bool write(const DOMNode* nodeToWrite,
|
||||
DOMLSOutput* const destination) = 0;
|
||||
|
||||
/**
|
||||
* Write out the specified node as described above in the description of
|
||||
* <code>DOMLSSerializer</code>. Writing a Document or Entity node produces a
|
||||
* serialized form that is well formed XML. Writing other node types
|
||||
* produces a fragment of text in a form that is not fully defined by
|
||||
* this document, but that should be useful to a human for debugging or
|
||||
* diagnostic purposes.
|
||||
*
|
||||
* @param nodeToWrite The <code>Document</code> or <code>Entity</code> node to
|
||||
* be written. For other node types, something sensible should be
|
||||
* written, but the exact serialized form is not specified.
|
||||
* @param uri The destination for the data to be written.
|
||||
* @return Returns <code>true</code> if <code>node</code> was
|
||||
* successfully serialized and <code>false</code> in case a failure
|
||||
* occured and the failure wasn't canceled by the error handler.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual bool writeToURI(const DOMNode* nodeToWrite,
|
||||
const XMLCh* uri) = 0;
|
||||
/**
|
||||
* Serialize the specified node as described above in the description of
|
||||
* <code>DOMLSSerializer</code>. The result of serializing the node is
|
||||
* returned as a string. Writing a Document or Entity node produces a
|
||||
* serialized form that is well formed XML. Writing other node types
|
||||
* produces a fragment of text in a form that is not fully defined by
|
||||
* this document, but that should be useful to a human for debugging or
|
||||
* diagnostic purposes.
|
||||
*
|
||||
* @param nodeToWrite The node to be written.
|
||||
* @param manager The memory manager to be used to allocate the result string.
|
||||
* If NULL is used, the memory manager used to construct the serializer will
|
||||
* be used.
|
||||
* @return Returns the serialized data, or <code>null</code> in case a
|
||||
* failure occured and the failure wasn't canceled by the error
|
||||
* handler. The returned string is always in UTF-16.
|
||||
* The encoding information available in DOMLSSerializer is ignored in writeToString().
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual XMLCh* writeToString(const DOMNode* nodeToWrite, MemoryManager* manager = NULL) = 0;
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard Extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard Extension */
|
||||
//@{
|
||||
/**
|
||||
* Called to indicate that this Writer is no longer in use
|
||||
* and that the implementation may relinquish any resources associated with it.
|
||||
*
|
||||
* Access to a released object will lead to unexpected result.
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
//@}
|
||||
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMLSSerializerFilter.hpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMLSSERIALIZERFILTER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMLSSERIALIZERFILTER_HPP
|
||||
|
||||
/**
|
||||
*
|
||||
* DOMLSSerializerFilter.hpp: interface for the DOMLSSerializerFilter class.
|
||||
*
|
||||
* DOMLSSerializerFilter provide applications the ability to examine nodes
|
||||
* as they are being serialized.
|
||||
*
|
||||
* DOMLSSerializerFilter lets the application decide what nodes should be
|
||||
* serialized or not.
|
||||
*
|
||||
* The DOMDocument, DOMDocumentType, DOMNotation, and DOMEntity nodes are not passed
|
||||
* to the filter.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
|
||||
|
||||
#include <xercesc/dom/DOMNodeFilter.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class CDOM_EXPORT DOMLSSerializerFilter : public DOMNodeFilter {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMLSSerializerFilter() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMLSSerializerFilter(const DOMLSSerializerFilter &);
|
||||
DOMLSSerializerFilter & operator = (const DOMLSSerializerFilter &);
|
||||
//@}
|
||||
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMLSSerializerFilter() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMLSSerializerFilter interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
/**
|
||||
* Interface from <code>DOMNodeFilter</code>,
|
||||
* to be implemented by implementation (derived class)
|
||||
*/
|
||||
virtual FilterAction acceptNode(const DOMNode* node) const = 0;
|
||||
|
||||
/**
|
||||
* Tells the DOMLSSerializer what types of nodes to show to the filter.
|
||||
* See <code>DOMNodeFilter</code> for definition of the constants.
|
||||
* The constant SHOW_ATTRIBUTE is meaningless here, attribute nodes will
|
||||
* never be passed to a DOMLSSerializerFilter.
|
||||
*
|
||||
* @return The constants of what types of nodes to show.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual ShowType getWhatToShow() const =0;
|
||||
//@}
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMLocator.hpp 676853 2008-07-15 09:58:05Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMLOCATOR_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMLOCATOR_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMNode;
|
||||
|
||||
|
||||
/**
|
||||
* DOMLocator is an interface that describes a location. (e.g. where an error
|
||||
* occured).
|
||||
*
|
||||
* @see DOMError#DOMError
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
|
||||
class CDOM_EXPORT DOMLocator
|
||||
{
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMLocator() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMLocator(const DOMLocator &);
|
||||
DOMLocator & operator = (const DOMLocator &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMLocator() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMLocator interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Get the line number where the error occured, or 0 if there is
|
||||
* no line number available.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual XMLFileLoc getLineNumber() const = 0;
|
||||
|
||||
/**
|
||||
* Get the column number where the error occured, or 0 if there
|
||||
* is no column number available.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual XMLFileLoc getColumnNumber() const = 0;
|
||||
|
||||
/**
|
||||
* Get the byte offset into the input source, or ~(XMLFilePos(0)) if
|
||||
* there is no byte offset available.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual XMLFilePos getByteOffset() const = 0;
|
||||
|
||||
/**
|
||||
* Get the UTF-16 offset into the input source, or ~(XMLFilePos(0)) if
|
||||
* there is no UTF-16 offset available.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual XMLFilePos getUtf16Offset() const = 0;
|
||||
|
||||
/**
|
||||
* Get the DOMNode where the error occured, or <code>null</code> if there
|
||||
* is no node available.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMNode* getRelatedNode() const = 0;
|
||||
|
||||
/**
|
||||
* Get the URI where the error occured, or <code>null</code> if there is no
|
||||
* URI available.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getURI() const = 0;
|
||||
//@}
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMMEMORYMANAGER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMMEMORYMANAGER_HPP
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Includes
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* The <code>DOMMemoryManager</code> interface exposes the memory allocation-related
|
||||
* functionalities of a <code>DOMDocument</code>
|
||||
*/
|
||||
|
||||
class CDOM_EXPORT DOMMemoryManager
|
||||
{
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMMemoryManager() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMMemoryManager(const DOMMemoryManager &);
|
||||
DOMMemoryManager & operator = (const DOMMemoryManager &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMMemoryManager() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data types
|
||||
// -----------------------------------------------------------------------
|
||||
enum NodeObjectType {
|
||||
ATTR_OBJECT = 0,
|
||||
ATTR_NS_OBJECT = 1,
|
||||
CDATA_SECTION_OBJECT = 2,
|
||||
COMMENT_OBJECT = 3,
|
||||
DOCUMENT_FRAGMENT_OBJECT = 4,
|
||||
DOCUMENT_TYPE_OBJECT = 5,
|
||||
ELEMENT_OBJECT = 6,
|
||||
ELEMENT_NS_OBJECT = 7,
|
||||
ENTITY_OBJECT = 8,
|
||||
ENTITY_REFERENCE_OBJECT = 9,
|
||||
NOTATION_OBJECT = 10,
|
||||
PROCESSING_INSTRUCTION_OBJECT = 11,
|
||||
TEXT_OBJECT = 12
|
||||
};
|
||||
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns the size of the chunks of memory allocated by the memory manager
|
||||
*
|
||||
* @return the dimension of the chunks of memory allocated by the memory manager
|
||||
*/
|
||||
virtual XMLSize_t getMemoryAllocationBlockSize() const = 0;
|
||||
|
||||
//@}
|
||||
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Set the size of the chunks of memory allocated by the memory manager
|
||||
*
|
||||
* @param size the new size of the chunks; it must be greater than 4KB
|
||||
*/
|
||||
virtual void setMemoryAllocationBlockSize(XMLSize_t size) = 0;
|
||||
//@}
|
||||
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Operations
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Allocate a memory block of the requested size from the managed pool
|
||||
*
|
||||
* @param amount the size of the new memory block
|
||||
*
|
||||
* @return the pointer to the newly allocated block
|
||||
*/
|
||||
virtual void* allocate(XMLSize_t amount) = 0;
|
||||
|
||||
/**
|
||||
* Allocate a memory block of the requested size from the managed pool of DOM objects
|
||||
*
|
||||
* @param amount the size of the new memory block
|
||||
* @param type the type of the DOM object that will be stored in the block
|
||||
*
|
||||
* @return the pointer to the newly allocated block
|
||||
*/
|
||||
virtual void* allocate(XMLSize_t amount, DOMMemoryManager::NodeObjectType type) = 0;
|
||||
|
||||
/**
|
||||
* Release a DOM object and place its memory back in the pool
|
||||
*
|
||||
* @param object the pointer to the DOM node
|
||||
* @param type the type of the DOM object
|
||||
*/
|
||||
virtual void release(DOMNode* object, DOMMemoryManager::NodeObjectType type) = 0;
|
||||
|
||||
/**
|
||||
* Allocate a memory block from the mnaged pool and copy the provided string
|
||||
*
|
||||
* @param src the string to be copied
|
||||
*
|
||||
* @return the pointer to the newly allocated block
|
||||
*/
|
||||
virtual XMLCh* cloneString(const XMLCh *src) = 0;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* End of file DOMMemoryManager.hpp
|
||||
*/
|
||||
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMNamedNodeMap.hpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMNAMEDNODEMAP_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMNAMEDNODEMAP_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMNode;
|
||||
|
||||
/**
|
||||
* <code>DOMNamedNodeMap</code>s are used to
|
||||
* represent collections of nodes that can be accessed by name.
|
||||
*
|
||||
* Note that <code>DOMNamedNodeMap</code> does not inherit from <code>DOMNodeList</code>;
|
||||
* <code>DOMNamedNodeMap</code>s are not maintained in any particular order.
|
||||
* Nodes contained in a <code>DOMNamedNodeMap</code> may
|
||||
* also be accessed by an ordinal index, but this is simply to allow
|
||||
* convenient enumeration of the contents, and
|
||||
* does not imply that the DOM specifies an order to these Nodes.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
class CDOM_EXPORT DOMNamedNodeMap {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMNamedNodeMap() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMNamedNodeMap(const DOMNamedNodeMap &);
|
||||
DOMNamedNodeMap & operator = (const DOMNamedNodeMap &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMNamedNodeMap() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMNamedNodeMap interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 1 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Adds a node using its <code>nodeName</code> attribute.
|
||||
*
|
||||
* <br>As the <code>nodeName</code> attribute is used to derive the name
|
||||
* which the node must be stored under, multiple nodes of certain types
|
||||
* (those that have a "special" string value) cannot be stored as the names
|
||||
* would clash. This is seen as preferable to allowing nodes to be aliased.
|
||||
* @param arg A node to store in a named node map. The node will later be
|
||||
* accessible using the value of the <code>nodeName</code> attribute of
|
||||
* the node. If a node with that name is already present in the map, it
|
||||
* is replaced by the new one.
|
||||
* @return If the new <code>DOMNode</code> replaces an existing node the
|
||||
* replaced <code>DOMNode</code> is returned,
|
||||
* otherwise <code>null</code> is returned.
|
||||
* @exception DOMException
|
||||
* WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a
|
||||
* different document than the one that created the
|
||||
* <code>DOMNamedNodeMap</code>.
|
||||
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this
|
||||
* <code>DOMNamedNodeMap</code> is readonly.
|
||||
* <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an
|
||||
* <code>DOMAttr</code> that is already an attribute of another
|
||||
* <code>DOMElement</code> object. The DOM user must explicitly clone
|
||||
* <code>DOMAttr</code> nodes to re-use them in other elements.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNode *setNamedItem(DOMNode *arg) = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns the <code>index</code>th item in the map.
|
||||
*
|
||||
* If <code>index</code>
|
||||
* is greater than or equal to the number of nodes in the map, this returns
|
||||
* <code>null</code>.
|
||||
* @param index Index into the map.
|
||||
* @return The node at the <code>index</code>th position in the
|
||||
* <code>DOMNamedNodeMap</code>, or <code>null</code> if that is not a valid
|
||||
* index.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNode *item(XMLSize_t index) const = 0;
|
||||
|
||||
/**
|
||||
* Retrieves a node specified by name.
|
||||
*
|
||||
* @param name The <code>nodeName</code> of a node to retrieve.
|
||||
* @return A <code>DOMNode</code> (of any type) with the specified <code>nodeName</code>, or
|
||||
* <code>null</code> if it does not identify any node in
|
||||
* the map.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNode *getNamedItem(const XMLCh *name) const = 0;
|
||||
|
||||
/**
|
||||
* The number of nodes in the map.
|
||||
*
|
||||
* The range of valid child node indices is
|
||||
* 0 to <code>length-1</code> inclusive.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual XMLSize_t getLength() const = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Node methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Removes a node specified by name.
|
||||
*
|
||||
* If the removed node is an
|
||||
* <code>DOMAttr</code> with a default value it is immediately replaced.
|
||||
* @param name The <code>nodeName</code> of a node to remove.
|
||||
* @return The node removed from the map if a node with such a name exists.
|
||||
* @exception DOMException
|
||||
* NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in
|
||||
* the map.
|
||||
* <br>
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this <code>DOMNamedNodeMap</code>
|
||||
* is readonly.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNode *removeNamedItem(const XMLCh *name) = 0;
|
||||
//@}
|
||||
|
||||
/** @name Functions introduced in DOM Level 2 */
|
||||
//@{
|
||||
/**
|
||||
* Retrieves a node specified by local name and namespace URI.
|
||||
*
|
||||
* @param namespaceURI The <em>namespace URI</em> of
|
||||
* the node to retrieve.
|
||||
* @param localName The <em>local name</em> of the node to retrieve.
|
||||
* @return A <code>DOMNode</code> (of any type) with the specified
|
||||
* local name and namespace URI, or <code>null</code> if they do not
|
||||
* identify any node in the map.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode *getNamedItemNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const = 0;
|
||||
|
||||
/**
|
||||
* Adds a node using its <CODE>namespaceURI</CODE> and <CODE>localName</CODE>.
|
||||
*
|
||||
* @param arg A node to store in a named node map. The node will later be
|
||||
* accessible using the value of the <CODE>namespaceURI</CODE> and
|
||||
* <CODE>localName</CODE> attribute of the node. If a node with those
|
||||
* namespace URI and local name is already present in the map, it is
|
||||
* replaced by the new one.
|
||||
* @return If the new <code>DOMNode</code> replaces an existing node the
|
||||
* replaced <code>DOMNode</code> is returned,
|
||||
* otherwise <code>null</code> is returned.
|
||||
* @exception DOMException
|
||||
* WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a
|
||||
* different document than the one that created the
|
||||
* <code>DOMNamedNodeMap</code>.
|
||||
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this
|
||||
* <code>DOMNamedNodeMap</code> is readonly.
|
||||
* <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an
|
||||
* <code>DOMAttr</code> that is already an attribute of another
|
||||
* <code>DOMElement</code> object. The DOM user must explicitly clone
|
||||
* <code>DOMAttr</code> nodes to re-use them in other elements.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode *setNamedItemNS(DOMNode *arg) = 0;
|
||||
|
||||
/**
|
||||
* Removes a node specified by local name and namespace URI.
|
||||
*
|
||||
* @param namespaceURI The <em>namespace URI</em> of
|
||||
* the node to remove.
|
||||
* @param localName The <em>local name</em> of the
|
||||
* node to remove. When this <code>DOMNamedNodeMap</code> contains the
|
||||
* attributes attached to an element, as returned by the attributes
|
||||
* attribute of the <code>DOMNode</code> interface, if the removed
|
||||
* attribute is known to have a default value, an attribute
|
||||
* immediately appears containing the default value
|
||||
* as well as the corresponding namespace URI, local name, and prefix.
|
||||
* @return The node removed from the map if a node with such a local name
|
||||
* and namespace URI exists.
|
||||
* @exception DOMException
|
||||
* NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in
|
||||
* the map.
|
||||
* <br>
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this <code>DOMNamedNodeMap</code>
|
||||
* is readonly.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode *removeNamedItemNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) = 0;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
#define GetDOMNamedNodeMapMemoryManager GET_INDIRECT_MM(fOwnerNode)
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,922 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMNode.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMNODE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMNODE_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMDocument;
|
||||
class DOMNamedNodeMap;
|
||||
class DOMNodeList;
|
||||
class DOMUserDataHandler;
|
||||
|
||||
/**
|
||||
* The <code>DOMNode</code> interface is the primary datatype for the entire
|
||||
* Document Object Model. It represents a single node in the document tree.
|
||||
* While all objects implementing the <code>DOMNode</code> interface expose
|
||||
* methods for dealing with children, not all objects implementing the
|
||||
* <code>DOMNode</code> interface may have children. For example,
|
||||
* <code>DOMText</code> nodes may not have children, and adding children to
|
||||
* such nodes results in a <code>DOMException</code> being raised.
|
||||
* <p>The attributes <code>nodeName</code>, <code>nodeValue</code> and
|
||||
* <code>attributes</code> are included as a mechanism to get at node
|
||||
* information without casting down to the specific derived interface. In
|
||||
* cases where there is no obvious mapping of these attributes for a
|
||||
* specific <code>nodeType</code> (e.g., <code>nodeValue</code> for an
|
||||
* <code>DOMElement</code> or <code>attributes</code> for a <code>DOMComment</code>
|
||||
* ), this returns <code>null</code>. Note that the specialized interfaces
|
||||
* may contain additional and more convenient mechanisms to get and set the
|
||||
* relevant information.
|
||||
* <p>The values of <code>nodeName</code>,
|
||||
* <code>nodeValue</code>, and <code>attributes</code> vary according to the
|
||||
* node type as follows:
|
||||
* <table border='1'>
|
||||
* <tr>
|
||||
* <td>Interface</td>
|
||||
* <td>nodeName</td>
|
||||
* <td>nodeValue</td>
|
||||
* <td>attributes</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>DOMAttr</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>name of attribute</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>value of attribute</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>DOMCDATASection</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>"\#cdata-section"</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>content of the CDATA Section</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>DOMComment</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>"\#comment"</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>content of the comment</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>DOMDocument</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>"\#document"</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>DOMDocumentFragment</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>"\#document-fragment"</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>DOMDocumentType</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>document type name</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>DOMElement</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>tag name</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>NamedNodeMap</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>DOMEntity</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>entity name</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>DOMEntityReference</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>name of entity referenced</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>DOMNotation</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>notation name</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>DOMProcessingInstruction</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>target</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>entire content excluding the target</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>DOMText</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>"\#text"</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>content of the text node</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>null</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
class CDOM_EXPORT DOMNode {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMNode() {}
|
||||
DOMNode(const DOMNode &) {}
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented operators */
|
||||
//@{
|
||||
DOMNode & operator = (const DOMNode &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMNode() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Class Types
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Public Constants */
|
||||
//@{
|
||||
/**
|
||||
* NodeType
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
enum NodeType {
|
||||
ELEMENT_NODE = 1,
|
||||
ATTRIBUTE_NODE = 2,
|
||||
TEXT_NODE = 3,
|
||||
CDATA_SECTION_NODE = 4,
|
||||
ENTITY_REFERENCE_NODE = 5,
|
||||
ENTITY_NODE = 6,
|
||||
PROCESSING_INSTRUCTION_NODE = 7,
|
||||
COMMENT_NODE = 8,
|
||||
DOCUMENT_NODE = 9,
|
||||
DOCUMENT_TYPE_NODE = 10,
|
||||
DOCUMENT_FRAGMENT_NODE = 11,
|
||||
NOTATION_NODE = 12
|
||||
};
|
||||
|
||||
/**
|
||||
* DocumentPosition:
|
||||
*
|
||||
* <p><code>DOCUMENT_POSITION_CONTAINED_BY:</code>
|
||||
* The node is contained by the reference node. A node which is contained is always following, too.</p>
|
||||
* <p><code>DOCUMENT_POSITION_CONTAINS:</code>
|
||||
* The node contains the reference node. A node which contains is always preceding, too.</p>
|
||||
* <p><code>DOCUMENT_POSITION_DISCONNECTED:</code>
|
||||
* The two nodes are disconnected. Order between disconnected nodes is always implementation-specific.</p>
|
||||
* <p><code>DOCUMENT_POSITION_FOLLOWING:</code>
|
||||
* The node follows the reference node.</p>
|
||||
* <p><code>DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:</code>
|
||||
* The determination of preceding versus following is implementation-specific.</p>
|
||||
* <p><code>DOCUMENT_POSITION_PRECEDING:</code>
|
||||
* The second node precedes the reference node.</p>
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
enum DocumentPosition {
|
||||
DOCUMENT_POSITION_DISCONNECTED = 0x01,
|
||||
DOCUMENT_POSITION_PRECEDING = 0x02,
|
||||
DOCUMENT_POSITION_FOLLOWING = 0x04,
|
||||
DOCUMENT_POSITION_CONTAINS = 0x08,
|
||||
DOCUMENT_POSITION_CONTAINED_BY = 0x10,
|
||||
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20
|
||||
};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMNode interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 1 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* The name of this node, depending on its type; see the table above.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh * getNodeName() const = 0;
|
||||
|
||||
/**
|
||||
* Gets the value of this node, depending on its type.
|
||||
*
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh * getNodeValue() const = 0;
|
||||
|
||||
/**
|
||||
* An enum value representing the type of the underlying object.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual NodeType getNodeType() const = 0;
|
||||
|
||||
/**
|
||||
* Gets the parent of this node.
|
||||
*
|
||||
* All nodes, except <code>DOMDocument</code>,
|
||||
* <code>DOMDocumentFragment</code>, and <code>DOMAttr</code> may have a parent.
|
||||
* However, if a node has just been created and not yet added to the tree,
|
||||
* or if it has been removed from the tree, a <code>null</code> DOMNode
|
||||
* is returned.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNode *getParentNode() const = 0;
|
||||
|
||||
/**
|
||||
* Gets a <code>DOMNodeList</code> that contains all children of this node.
|
||||
*
|
||||
* If there
|
||||
* are no children, this is a <code>DOMNodeList</code> containing no nodes.
|
||||
* The content of the returned <code>DOMNodeList</code> is "live" in the sense
|
||||
* that, for instance, changes to the children of the node object that
|
||||
* it was created from are immediately reflected in the nodes returned by
|
||||
* the <code>DOMNodeList</code> accessors; it is not a static snapshot of the
|
||||
* content of the node. This is true for every <code>DOMNodeList</code>,
|
||||
* including the ones returned by the <code>getElementsByTagName</code>
|
||||
* method.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNodeList *getChildNodes() const = 0;
|
||||
/**
|
||||
* Gets the first child of this node.
|
||||
*
|
||||
* If there is no such node, this returns <code>null</code>.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNode *getFirstChild() const = 0;
|
||||
|
||||
/**
|
||||
* Gets the last child of this node.
|
||||
*
|
||||
* If there is no such node, this returns <code>null</code>.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNode *getLastChild() const = 0;
|
||||
|
||||
/**
|
||||
* Gets the node immediately preceding this node.
|
||||
*
|
||||
* If there is no such node, this returns <code>null</code>.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNode *getPreviousSibling() const = 0;
|
||||
|
||||
/**
|
||||
* Gets the node immediately following this node.
|
||||
*
|
||||
* If there is no such node, this returns <code>null</code>.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNode *getNextSibling() const = 0;
|
||||
|
||||
/**
|
||||
* Gets a <code>DOMNamedNodeMap</code> containing the attributes of this node (if it
|
||||
* is an <code>DOMElement</code>) or <code>null</code> otherwise.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNamedNodeMap *getAttributes() const = 0;
|
||||
|
||||
/**
|
||||
* Gets the <code>DOMDocument</code> object associated with this node.
|
||||
*
|
||||
* This is also
|
||||
* the <code>DOMDocument</code> object used to create new nodes. When this
|
||||
* node is a <code>DOMDocument</code> or a <code>DOMDocumentType</code>
|
||||
* which is not used with any <code>DOMDocument</code> yet, this is
|
||||
* <code>null</code>.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMDocument *getOwnerDocument() const = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Node methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a duplicate of this node.
|
||||
*
|
||||
* This function serves as a generic copy constructor for nodes.
|
||||
*
|
||||
* The duplicate node has no parent (
|
||||
* <code>parentNode</code> returns <code>null</code>.).
|
||||
* <br>Cloning an <code>DOMElement</code> copies all attributes and their
|
||||
* values, including those generated by the XML processor to represent
|
||||
* defaulted attributes, but this method does not copy any text it contains
|
||||
* unless it is a deep clone, since the text is contained in a child
|
||||
* <code>DOMText</code> node. Cloning any other type of node simply returns a
|
||||
* copy of this node.
|
||||
* @param deep If <code>true</code>, recursively clone the subtree under the
|
||||
* specified node; if <code>false</code>, clone only the node itself (and
|
||||
* its attributes, if it is an <code>DOMElement</code>).
|
||||
* @return The duplicate node.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNode * cloneNode(bool deep) const = 0;
|
||||
|
||||
/**
|
||||
* Inserts the node <code>newChild</code> before the existing child node
|
||||
* <code>refChild</code>.
|
||||
*
|
||||
* If <code>refChild</code> is <code>null</code>,
|
||||
* insert <code>newChild</code> at the end of the list of children.
|
||||
* <br>If <code>newChild</code> is a <code>DOMDocumentFragment</code> object,
|
||||
* all of its children are inserted, in the same order, before
|
||||
* <code>refChild</code>. If the <code>newChild</code> is already in the
|
||||
* tree, it is first removed. Note that a <code>DOMNode</code> that
|
||||
* has never been assigned to refer to an actual node is == null.
|
||||
* @param newChild The node to insert.
|
||||
* @param refChild The reference node, i.e., the node before which the new
|
||||
* node must be inserted.
|
||||
* @return The node being inserted.
|
||||
* @exception DOMException
|
||||
* HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
|
||||
* allow children of the type of the <code>newChild</code> node, or if
|
||||
* the node to insert is one of this node's ancestors.
|
||||
* <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
|
||||
* from a different document than the one that created this node.
|
||||
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the node being
|
||||
* inserted is readonly.
|
||||
* <br>NOT_FOUND_ERR: Raised if <code>refChild</code> is not a child of
|
||||
* this node.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNode *insertBefore(DOMNode *newChild,
|
||||
DOMNode *refChild) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Replaces the child node <code>oldChild</code> with <code>newChild</code>
|
||||
* in the list of children, and returns the <code>oldChild</code> node.
|
||||
*
|
||||
* If <CODE>newChild</CODE> is a <CODE>DOMDocumentFragment</CODE> object,
|
||||
* <CODE>oldChild</CODE> is replaced by all of the <CODE>DOMDocumentFragment</CODE>
|
||||
* children, which are inserted in the same order.
|
||||
*
|
||||
* If the <code>newChild</code> is already in the tree, it is first removed.
|
||||
* @param newChild The new node to put in the child list.
|
||||
* @param oldChild The node being replaced in the list.
|
||||
* @return The node replaced.
|
||||
* @exception DOMException
|
||||
* HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
|
||||
* allow children of the type of the <code>newChild</code> node, or it
|
||||
* the node to put in is one of this node's ancestors.
|
||||
* <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
|
||||
* from a different document than the one that created this node.
|
||||
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the new node is readonly.
|
||||
* <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of
|
||||
* this node.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNode *replaceChild(DOMNode *newChild,
|
||||
DOMNode *oldChild) = 0;
|
||||
/**
|
||||
* Removes the child node indicated by <code>oldChild</code> from the list
|
||||
* of children, and returns it.
|
||||
*
|
||||
* @param oldChild The node being removed.
|
||||
* @return The node removed.
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
|
||||
* <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of
|
||||
* this node.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNode *removeChild(DOMNode *oldChild) = 0;
|
||||
|
||||
/**
|
||||
* Adds the node <code>newChild</code> to the end of the list of children of
|
||||
* this node.
|
||||
*
|
||||
* If the <code>newChild</code> is already in the tree, it is
|
||||
* first removed.
|
||||
* @param newChild The node to add.If it is a <code>DOMDocumentFragment</code>
|
||||
* object, the entire contents of the document fragment are moved into
|
||||
* the child list of this node
|
||||
* @return The node added.
|
||||
* @exception DOMException
|
||||
* HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
|
||||
* allow children of the type of the <code>newChild</code> node, or if
|
||||
* the node to append is one of this node's ancestors.
|
||||
* <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
|
||||
* from a different document than the one that created this node.
|
||||
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the node being
|
||||
* appended is readonly.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNode *appendChild(DOMNode *newChild) = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Query methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* This is a convenience method to allow easy determination of whether a
|
||||
* node has any children.
|
||||
*
|
||||
* @return <code>true</code> if the node has any children,
|
||||
* <code>false</code> if the node has no children.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual bool hasChildNodes() const = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the value of the node.
|
||||
*
|
||||
* Any node which can have a nodeValue will
|
||||
* also accept requests to set it to a string. The exact response to
|
||||
* this varies from node to node -- Attribute, for example, stores
|
||||
* its values in its children and has to replace them with a new Text
|
||||
* holding the replacement value.
|
||||
*
|
||||
* For most types of Node, value is null and attempting to set it
|
||||
* will throw DOMException(NO_MODIFICATION_ALLOWED_ERR). This will
|
||||
* also be thrown if the node is read-only.
|
||||
* @see #getNodeValue
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual void setNodeValue(const XMLCh *nodeValue) = 0;
|
||||
//@}
|
||||
|
||||
/** @name Functions introduced in DOM Level 2. */
|
||||
//@{
|
||||
/**
|
||||
* Puts all <CODE>DOMText</CODE>
|
||||
* nodes in the full depth of the sub-tree underneath this <CODE>DOMNode</CODE>,
|
||||
* including attribute nodes, into a "normal" form where only markup (e.g.,
|
||||
* tags, comments, processing instructions, CDATA sections, and entity
|
||||
* references) separates <CODE>DOMText</CODE>
|
||||
* nodes, i.e., there are neither adjacent <CODE>DOMText</CODE>
|
||||
* nodes nor empty <CODE>DOMText</CODE>
|
||||
* nodes. This can be used to ensure that the DOM view of a document is the
|
||||
* same as if it were saved and re-loaded, and is useful when operations
|
||||
* (such as XPointer lookups) that depend on a particular document tree
|
||||
* structure are to be used.
|
||||
* <P><B>Note:</B> In cases where the document contains <CODE>DOMCDATASections</CODE>,
|
||||
* the normalize operation alone may not be sufficient, since XPointers do
|
||||
* not differentiate between <CODE>DOMText</CODE>
|
||||
* nodes and <CODE>DOMCDATASection</CODE>
|
||||
* nodes.</P>
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void normalize() = 0;
|
||||
|
||||
/**
|
||||
* Tests whether the DOM implementation implements a specific
|
||||
* feature and that feature is supported by this node.
|
||||
*
|
||||
* @param feature The string of the feature to test. This is the same
|
||||
* name as what can be passed to the method <code>hasFeature</code> on
|
||||
* <code>DOMImplementation</code>.
|
||||
* @param version This is the version number of the feature to test. In
|
||||
* Level 2, version 1, this is the string "2.0". If the version is not
|
||||
* specified, supporting any version of the feature will cause the
|
||||
* method to return <code>true</code>.
|
||||
* @return Returns <code>true</code> if the specified feature is supported
|
||||
* on this node, <code>false</code> otherwise.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual bool isSupported(const XMLCh *feature,
|
||||
const XMLCh *version) const = 0;
|
||||
|
||||
/**
|
||||
* Get the <em>namespace URI</em> of
|
||||
* this node, or <code>null</code> if it is unspecified.
|
||||
* <p>
|
||||
* This is not a computed value that is the result of a namespace lookup
|
||||
* based on an examination of the namespace declarations in scope. It is
|
||||
* merely the namespace URI given at creation time.
|
||||
* <p>
|
||||
* For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
|
||||
* <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
|
||||
* such as <CODE>createElement</CODE> from the <CODE>DOMDocument</CODE>
|
||||
* interface, this is always <CODE>null</CODE>.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual const XMLCh * getNamespaceURI() const = 0;
|
||||
|
||||
/**
|
||||
* Get the <em>namespace prefix</em>
|
||||
* of this node, or <code>null</code> if it is unspecified.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual const XMLCh * getPrefix() const = 0;
|
||||
|
||||
/**
|
||||
* Returns the local part of the <em>qualified name</em> of this node.
|
||||
* <p>
|
||||
* For nodes created with a DOM Level 1 method, such as
|
||||
* <code>createElement</code> from the <code>DOMDocument</code> interface,
|
||||
* it is null.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual const XMLCh * getLocalName() const = 0;
|
||||
|
||||
/**
|
||||
* Set the <em>namespace prefix</em> of this node.
|
||||
* <p>
|
||||
* Note that setting this attribute, when permitted, changes
|
||||
* the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
|
||||
* name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
|
||||
* attributes of the <CODE>DOMElement</CODE> and <CODE>DOMAttr</CODE>
|
||||
* interfaces, when applicable.
|
||||
* <p>
|
||||
* Note also that changing the prefix of an
|
||||
* attribute, that is known to have a default value, does not make a new
|
||||
* attribute with the default value and the original prefix appear, since the
|
||||
* <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
|
||||
*
|
||||
*
|
||||
* @param prefix The prefix of this node.
|
||||
* @exception DOMException
|
||||
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains
|
||||
* an illegal character.
|
||||
* <br>
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
|
||||
* <br>
|
||||
* NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
|
||||
* malformed, if the <CODE>namespaceURI</CODE> of this node is
|
||||
* <CODE>null</CODE>, if the specified prefix is "xml" and the
|
||||
* <CODE>namespaceURI</CODE> of this node is different from
|
||||
* "http://www.w3.org/XML/1998/namespace", if this node is an attribute
|
||||
* and the specified prefix is "xmlns" and the
|
||||
* <CODE>namespaceURI</CODE> of this node is different from
|
||||
* "http://www.w3.org/2000/xmlns/", or if this node is an attribute and
|
||||
* the <CODE>qualifiedName</CODE> of this node is "xmlns".
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void setPrefix(const XMLCh * prefix) = 0;
|
||||
|
||||
/**
|
||||
* Returns whether this node (if it is an element) has any attributes.
|
||||
* @return <code>true</code> if this node has any attributes,
|
||||
* <code>false</code> otherwise.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual bool hasAttributes() const = 0;
|
||||
//@}
|
||||
|
||||
/** @name Functions introduced in DOM Level 3. */
|
||||
//@{
|
||||
/**
|
||||
* Returns whether this node is the same node as the given one.
|
||||
* <br>This method provides a way to determine whether two
|
||||
* <code>DOMNode</code> references returned by the implementation reference
|
||||
* the same object. When two <code>DOMNode</code> references are references
|
||||
* to the same object, even if through a proxy, the references may be
|
||||
* used completely interchangeably, such that all attributes have the
|
||||
* same values and calling the same DOM method on either reference
|
||||
* always has exactly the same effect.
|
||||
*
|
||||
* @param other The node to test against.
|
||||
* @return Returns <code>true</code> if the nodes are the same,
|
||||
* <code>false</code> otherwise.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual bool isSameNode(const DOMNode* other) const = 0;
|
||||
|
||||
/**
|
||||
* Tests whether two nodes are equal.
|
||||
* <br>This method tests for equality of nodes, not sameness (i.e.,
|
||||
* whether the two nodes are pointers to the same object) which can be
|
||||
* tested with <code>DOMNode::isSameNode</code>. All nodes that are the same
|
||||
* will also be equal, though the reverse may not be true.
|
||||
* <br>Two nodes are equal if and only if the following conditions are
|
||||
* satisfied: The two nodes are of the same type.The following string
|
||||
* attributes are equal: <code>nodeName</code>, <code>localName</code>,
|
||||
* <code>namespaceURI</code>, <code>prefix</code>, <code>nodeValue</code>
|
||||
* , <code>baseURI</code>. This is: they are both <code>null</code>, or
|
||||
* they have the same length and are character for character identical.
|
||||
* The <code>attributes</code> <code>DOMNamedNodeMaps</code> are equal.
|
||||
* This is: they are both <code>null</code>, or they have the same
|
||||
* length and for each node that exists in one map there is a node that
|
||||
* exists in the other map and is equal, although not necessarily at the
|
||||
* same index.The <code>childNodes</code> <code>DOMNodeLists</code> are
|
||||
* equal. This is: they are both <code>null</code>, or they have the
|
||||
* same length and contain equal nodes at the same index. This is true
|
||||
* for <code>DOMAttr</code> nodes as for any other type of node. Note that
|
||||
* normalization can affect equality; to avoid this, nodes should be
|
||||
* normalized before being compared.
|
||||
* <br>For two <code>DOMDocumentType</code> nodes to be equal, the following
|
||||
* conditions must also be satisfied: The following string attributes
|
||||
* are equal: <code>publicId</code>, <code>systemId</code>,
|
||||
* <code>internalSubset</code>.The <code>entities</code>
|
||||
* <code>DOMNamedNodeMaps</code> are equal.The <code>notations</code>
|
||||
* <code>DOMNamedNodeMaps</code> are equal.
|
||||
* <br>On the other hand, the following do not affect equality: the
|
||||
* <code>ownerDocument</code> attribute, the <code>specified</code>
|
||||
* attribute for <code>DOMAttr</code> nodes, the
|
||||
* <code>isWhitespaceInElementContent</code> attribute for
|
||||
* <code>DOMText</code> nodes, as well as any user data or event listeners
|
||||
* registered on the nodes.
|
||||
*
|
||||
* @param arg The node to compare equality with.
|
||||
* @return If the nodes, and possibly subtrees are equal,
|
||||
* <code>true</code> otherwise <code>false</code>.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual bool isEqualNode(const DOMNode* arg) const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Associate an object to a key on this node. The object can later be
|
||||
* retrieved from this node by calling <code>getUserData</code> with the
|
||||
* same key.
|
||||
*
|
||||
* Deletion of the user data remains the responsibility of the
|
||||
* application program; it will not be automatically deleted when
|
||||
* the nodes themselves are reclaimed.
|
||||
*
|
||||
* Both the parameter <code>data</code> and the returned object are
|
||||
* void pointer, it is applications' responsibility to keep track of
|
||||
* their original type. Casting them to the wrong type may result
|
||||
* unexpected behavior.
|
||||
*
|
||||
* @param key The key to associate the object to.
|
||||
* @param data The object to associate to the given key, or
|
||||
* <code>null</code> to remove any existing association to that key.
|
||||
* @param handler The handler to associate to that key, or
|
||||
* <code>null</code>.
|
||||
* @return Returns the void* object previously associated to
|
||||
* the given key on this node, or <code>null</code> if there was none.
|
||||
* @see #getUserData
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void* setUserData(const XMLCh* key,
|
||||
void* data,
|
||||
DOMUserDataHandler* handler) = 0;
|
||||
|
||||
/**
|
||||
* Retrieves the object associated to a key on a this node. The object
|
||||
* must first have been set to this node by calling
|
||||
* <code>setUserData</code> with the same key.
|
||||
*
|
||||
* @param key The key the object is associated to.
|
||||
* @return Returns the <code>void*</code> associated to the given key
|
||||
* on this node, or <code>null</code> if there was none.
|
||||
* @see #setUserData
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void* getUserData(const XMLCh* key) const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* The absolute base URI of this node or <code>null</code> if undefined.
|
||||
* This value is computed according to . However, when the
|
||||
* <code>DOMDocument</code> supports the feature "HTML" , the base URI is
|
||||
* computed using first the value of the href attribute of the HTML BASE
|
||||
* element if any, and the value of the <code>documentURI</code>
|
||||
* attribute from the <code>DOMDocument</code> interface otherwise.
|
||||
*
|
||||
* <br> When the node is an <code>DOMElement</code>, a <code>DOMDocument</code>
|
||||
* or a a <code>DOMProcessingInstruction</code>, this attribute represents
|
||||
* the properties [base URI] defined in . When the node is a
|
||||
* <code>DOMNotation</code>, an <code>DOMEntity</code>, or an
|
||||
* <code>DOMEntityReference</code>, this attribute represents the
|
||||
* properties [declaration base URI].
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getBaseURI() const = 0;
|
||||
|
||||
/**
|
||||
* Compares the reference node, i.e. the node on which this method is being called,
|
||||
* with a node, i.e. the one passed as a parameter, with regard to their position
|
||||
* in the document and according to the document order.
|
||||
*
|
||||
* @param other The node to compare against this node.
|
||||
* @return Returns how the given node is positioned relatively to this
|
||||
* node.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual short compareDocumentPosition(const DOMNode* other) const = 0;
|
||||
|
||||
/**
|
||||
* This attribute returns the text content of this node and its
|
||||
* descendants. No serialization is performed, the returned string
|
||||
* does not contain any markup. No whitespace normalization is
|
||||
* performed and the returned string does not contain the white
|
||||
* spaces in element content.
|
||||
*
|
||||
* <br>The string returned is made of the text content of this node
|
||||
* depending on its type, as defined below:
|
||||
* <table border='1'>
|
||||
* <tr>
|
||||
* <td>Node type</td>
|
||||
* <td>Content</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>
|
||||
* ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
|
||||
* DOCUMENT_FRAGMENT_NODE</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
|
||||
* attribute value of every child node, excluding COMMENT_NODE and
|
||||
* PROCESSING_INSTRUCTION_NODE nodes</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE,
|
||||
* CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>
|
||||
* <code>nodeValue</code></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>
|
||||
* null</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* @exception DOMException
|
||||
* DOMSTRING_SIZE_ERR: Raised when it would return more characters than
|
||||
* fit in a <code>DOMString</code> variable on the implementation
|
||||
* platform.
|
||||
* @see #setTextContent
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getTextContent() const = 0;
|
||||
|
||||
/**
|
||||
* This attribute removes any possible children this node may have and, if the
|
||||
* new string is not empty or null, replaced by a single <code>DOMText</code>
|
||||
* node containing the string this attribute is set to. No parsing is
|
||||
* performed, the input string is taken as pure textual content.
|
||||
*
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
||||
* @see #getTextContent
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void setTextContent(const XMLCh* textContent) = 0;
|
||||
|
||||
/**
|
||||
* Look up the prefix associated to the given namespace URI, starting from this node.
|
||||
* The default namespace declarations are ignored by this method.
|
||||
*
|
||||
* @param namespaceURI The namespace URI to look for.
|
||||
* @return Returns an associated namespace prefix if found,
|
||||
* <code>null</code> if none is found. If more
|
||||
* than one prefix are associated to the namespace prefix, the
|
||||
* returned namespace prefix is implementation dependent.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* lookupPrefix(const XMLCh* namespaceURI) const = 0;
|
||||
|
||||
/**
|
||||
* This method checks if the specified <code>namespaceURI</code> is the
|
||||
* default namespace or not.
|
||||
*
|
||||
* @param namespaceURI The namespace URI to look for.
|
||||
* @return <code>true</code> if the specified <code>namespaceURI</code>
|
||||
* is the default namespace, <code>false</code> otherwise.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual bool isDefaultNamespace(const XMLCh* namespaceURI) const = 0;
|
||||
|
||||
/**
|
||||
* Look up the namespace URI associated to the given prefix, starting from
|
||||
* this node.
|
||||
*
|
||||
* @param prefix The prefix to look for. If this parameter is
|
||||
* <code>null</code>, the method will return the default namespace URI
|
||||
* if any.
|
||||
* @return Returns the associated namespace URI or <code>null</code> if
|
||||
* none is found.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* lookupNamespaceURI(const XMLCh* prefix) const = 0;
|
||||
|
||||
/**
|
||||
* This method makes available a <code>DOMNode</code>'s specialized interface
|
||||
*
|
||||
* @param feature The name of the feature requested (case-insensitive).
|
||||
* @param version The version of the feature requested.
|
||||
* @return Returns an alternate <code>DOMNode</code> which implements the
|
||||
* specialized APIs of the specified feature, if any, or
|
||||
* <code>null</code> if there is no alternate <code>DOMNode</code> which
|
||||
* implements interfaces associated with that feature. Any alternate
|
||||
* <code>DOMNode</code> returned by this method must delegate to the
|
||||
* primary core <code>DOMNode</code> and not return results inconsistent
|
||||
* with the primary core <code>DOMNode</code> such as <code>key</code>,
|
||||
* <code>attributes</code>, <code>childNodes</code>, etc.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void* getFeature(const XMLCh* feature, const XMLCh* version) const = 0;
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard Extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard Extension */
|
||||
//@{
|
||||
/**
|
||||
* Called to indicate that this Node (and its associated children) is no longer in use
|
||||
* and that the implementation may relinquish any resources associated with it and
|
||||
* its associated children.
|
||||
*
|
||||
* If this is a document, any nodes it owns (created by DOMDocument::createXXXX())
|
||||
* are also released.
|
||||
*
|
||||
* Access to a released object will lead to unexpected result.
|
||||
*
|
||||
* @exception DOMException
|
||||
* INVALID_ACCESS_ERR: Raised if this Node has a parent and thus should not be released yet.
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
//@}
|
||||
#if defined(XML_DOMREFCOUNT_EXPERIMENTAL)
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard Extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard Extension */
|
||||
//@{
|
||||
/**
|
||||
* This is custom function which can be implemented by classes deriving
|
||||
* from DOMNode for implementing reference counting on DOMNodes. Any
|
||||
* implementation which has memory management model which involves
|
||||
* disposing of nodes immediately after being used can override this
|
||||
* function to do that job.
|
||||
*/
|
||||
virtual void decRefCount() {}
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard Extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard Extension */
|
||||
//@{
|
||||
/**
|
||||
* This is custom function which can be implemented by classes deriving
|
||||
* from DOMNode for implementing reference counting on DOMNodes.
|
||||
*/
|
||||
virtual void incRefCount() {}
|
||||
//@}
|
||||
#endif
|
||||
};
|
||||
|
||||
/***
|
||||
* Utilities macros for getting memory manager within DOM
|
||||
***/
|
||||
#define GET_OWNER_DOCUMENT(ptr) \
|
||||
((DOMDocumentImpl*)(ptr->getOwnerDocument()))
|
||||
|
||||
#define GET_DIRECT_MM(ptr) \
|
||||
(ptr ? ((DOMDocumentImpl*)ptr)->getMemoryManager() : XMLPlatformUtils::fgMemoryManager)
|
||||
|
||||
#define GET_INDIRECT_MM(ptr) \
|
||||
(!ptr ? XMLPlatformUtils::fgMemoryManager : \
|
||||
GET_OWNER_DOCUMENT(ptr) ? GET_OWNER_DOCUMENT(ptr)->getMemoryManager() : \
|
||||
XMLPlatformUtils::fgMemoryManager)
|
||||
|
||||
/***
|
||||
* For DOMNode and its derivatives
|
||||
***/
|
||||
#define GetDOMNodeMemoryManager GET_INDIRECT_MM(this)
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMNodeFilter.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMNODEFILTER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMNODEFILTER_HPP
|
||||
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* Filters are objects that know how to "filter out" nodes. If a
|
||||
* <code>DOMNodeIterator</code> or <code>DOMTreeWalker</code> is given a
|
||||
* <code>DOMNodeFilter</code>, it applies the filter before it returns the next
|
||||
* node. If the filter says to accept the node, the traversal logic returns
|
||||
* it; otherwise, traversal looks for the next node and pretends that the
|
||||
* node that was rejected was not there.
|
||||
* <p>The DOM does not provide any filters. <code>DOMNodeFilter</code> is just an
|
||||
* interface that users can implement to provide their own filters.
|
||||
* <p><code>DOMNodeFilters</code> do not need to know how to traverse from node
|
||||
* to node, nor do they need to know anything about the data structure that
|
||||
* is being traversed. This makes it very easy to write filters, since the
|
||||
* only thing they have to know how to do is evaluate a single node. One
|
||||
* filter may be used with a number of different kinds of traversals,
|
||||
* encouraging code reuse.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
|
||||
class CDOM_EXPORT DOMNodeFilter
|
||||
{
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMNodeFilter() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMNodeFilter(const DOMNodeFilter &);
|
||||
DOMNodeFilter & operator = (const DOMNodeFilter &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMNodeFilter() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Class Types
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Public Constants */
|
||||
//@{
|
||||
/**
|
||||
* Constants returned by acceptNode.
|
||||
*
|
||||
* <p><code>FILTER_ACCEPT:</code>
|
||||
* Accept the node. Navigation methods defined for
|
||||
* <code>DOMNodeIterator</code> or <code>DOMTreeWalker</code> will return this
|
||||
* node.</p>
|
||||
*
|
||||
* <p><code>FILTER_REJECT:</code>
|
||||
* Reject the node. Navigation methods defined for
|
||||
* <code>DOMNodeIterator</code> or <code>DOMTreeWalker</code> will not return
|
||||
* this node. For <code>DOMTreeWalker</code>, the children of this node
|
||||
* will also be rejected. <code>DOMNodeIterators</code> treat this as a
|
||||
* synonym for <code>FILTER_SKIP.</code></p>
|
||||
*
|
||||
* <p><code>FILTER_SKIP:</code>
|
||||
* Skip this single node. Navigation methods defined for
|
||||
* <code>DOMNodeIterator</code> or <code>DOMTreeWalker</code> will not return
|
||||
* this node. For both <code>DOMNodeIterator</code> and
|
||||
* <code>DOMTreeWalker</code>, the children of this node will still be
|
||||
* considered.</p>
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
enum FilterAction {FILTER_ACCEPT = 1,
|
||||
FILTER_REJECT = 2,
|
||||
FILTER_SKIP = 3};
|
||||
|
||||
/**
|
||||
* Constants for whatToShow
|
||||
*
|
||||
* <p><code>SHOW_ALL:</code>
|
||||
* Show all <code>DOMNode(s)</code>.</p>
|
||||
*
|
||||
* <p><code>SHOW_ELEMENT:</code>
|
||||
* Show <code>DOMElement</code> nodes.</p>
|
||||
*
|
||||
* <p><code>SHOW_ATTRIBUTE:</code>
|
||||
* Show <code>DOMAttr</code> nodes. This is meaningful only when creating an
|
||||
* <code>DOMNodeIterator</code> or <code>DOMTreeWalker</code> with an
|
||||
* attribute node as its <code>root</code>; in this case, it means that
|
||||
* the attribute node will appear in the first position of the iteration
|
||||
* or traversal. Since attributes are never children of other nodes,
|
||||
* they do not appear when traversing over the document tree.</p>
|
||||
*
|
||||
* <p><code>SHOW_TEXT:</code>
|
||||
* Show <code>DOMText</code> nodes.</p>
|
||||
*
|
||||
* <p><code>SHOW_CDATA_SECTION:</code>
|
||||
* Show <code>DOMCDATASection</code> nodes.</p>
|
||||
*
|
||||
* <p><code>SHOW_ENTITY_REFERENCE:</code>
|
||||
* Show <code>DOMEntityReference</code> nodes.</p>
|
||||
*
|
||||
* <p><code>SHOW_ENTITY:</code>
|
||||
* Show <code>DOMEntity</code> nodes. This is meaningful only when creating
|
||||
* an <code>DOMNodeIterator</code> or <code>DOMTreeWalker</code> with an
|
||||
* <code>DOMEntity</code> node as its <code>root</code>; in this case, it
|
||||
* means that the <code>DOMEntity</code> node will appear in the first
|
||||
* position of the traversal. Since entities are not part of the
|
||||
* document tree, they do not appear when traversing over the document
|
||||
* tree.</p>
|
||||
*
|
||||
* <p><code>SHOW_PROCESSING_INSTRUCTION:</code>
|
||||
* Show <code>DOMProcessingInstruction</code> nodes.</p>
|
||||
*
|
||||
* <p><code>SHOW_COMMENT:</code>
|
||||
* Show <code>DOMComment</code> nodes.</p>
|
||||
*
|
||||
* <p><code>SHOW_DOCUMENT:</code>
|
||||
* Show <code>DOMDocument</code> nodes.</p>
|
||||
*
|
||||
* <p><code>SHOW_DOCUMENT_TYPE:</code>
|
||||
* Show <code>DOMDocumentType</code> nodes.</p>
|
||||
*
|
||||
* <p><code>SHOW_DOCUMENT_FRAGMENT:</code>
|
||||
* Show <code>DOMDocumentFragment</code> nodes.</p>
|
||||
*
|
||||
* <p><code>SHOW_NOTATION:</code>
|
||||
* Show <code>DOMNotation</code> nodes. This is meaningful only when creating
|
||||
* an <code>DOMNodeIterator</code> or <code>DOMTreeWalker</code> with a
|
||||
* <code>DOMNotation</code> node as its <code>root</code>; in this case, it
|
||||
* means that the <code>DOMNotation</code> node will appear in the first
|
||||
* position of the traversal. Since notations are not part of the
|
||||
* document tree, they do not appear when traversing over the document
|
||||
* tree.</p>
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
enum ShowTypeMasks {
|
||||
SHOW_ALL = 0x0000FFFF,
|
||||
SHOW_ELEMENT = 0x00000001,
|
||||
SHOW_ATTRIBUTE = 0x00000002,
|
||||
SHOW_TEXT = 0x00000004,
|
||||
SHOW_CDATA_SECTION = 0x00000008,
|
||||
SHOW_ENTITY_REFERENCE = 0x00000010,
|
||||
SHOW_ENTITY = 0x00000020,
|
||||
SHOW_PROCESSING_INSTRUCTION = 0x00000040,
|
||||
SHOW_COMMENT = 0x00000080,
|
||||
SHOW_DOCUMENT = 0x00000100,
|
||||
SHOW_DOCUMENT_TYPE = 0x00000200,
|
||||
SHOW_DOCUMENT_FRAGMENT = 0x00000400,
|
||||
SHOW_NOTATION = 0x00000800
|
||||
};
|
||||
|
||||
typedef unsigned long ShowType;
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMNodeFilter interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 2 */
|
||||
//@{
|
||||
/**
|
||||
* Test whether a specified node is visible in the logical view of a
|
||||
* <code>DOMTreeWalker</code> or <code>DOMNodeIterator</code>. This function
|
||||
* will be called by the implementation of <code>DOMTreeWalker</code> and
|
||||
* <code>DOMNodeIterator</code>; it is not normally called directly from
|
||||
* user code. (Though you could do so if you wanted to use the same
|
||||
* filter to guide your own application logic.)
|
||||
* @param node The node to check to see if it passes the filter or not.
|
||||
* @return A constant to determine whether the node is accepted,
|
||||
* rejected, or skipped, as defined above.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual FilterAction acceptNode (const DOMNode* node) const =0;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMNodeIterator.hpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMNODEITERATOR_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMNODEITERATOR_HPP
|
||||
|
||||
#include <xercesc/dom/DOMNodeFilter.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* <code>DOMNodeIterators</code> are used to step through a set of nodes, e.g.
|
||||
* the set of nodes in a <code>DOMNodeList</code>, the document subtree
|
||||
* governed by a particular <code>DOMNode</code>, the results of a query, or
|
||||
* any other set of nodes. The set of nodes to be iterated is determined by
|
||||
* the implementation of the <code>DOMNodeIterator</code>. DOM Level 2
|
||||
* specifies a single <code>DOMNodeIterator</code> implementation for
|
||||
* document-order traversal of a document subtree. Instances of these
|
||||
* <code>DOMNodeIterators</code> are created by calling
|
||||
* <code>DOMDocumentTraversal</code><code>.createNodeIterator()</code>.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
class CDOM_EXPORT DOMNodeIterator
|
||||
{
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMNodeIterator() {}
|
||||
DOMNodeIterator(const DOMNodeIterator &) {}
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented operators */
|
||||
//@{
|
||||
DOMNodeIterator & operator = (const DOMNodeIterator &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMNodeIterator() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMNodeFilter interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 2 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* The <code>root</code> node of the <code>DOMNodeIterator</code>, as specified
|
||||
* when it was created.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode* getRoot() = 0;
|
||||
/**
|
||||
* Return which node types are presented via the iterator.
|
||||
* This attribute determines which node types are presented via the
|
||||
* <code>DOMNodeIterator</code>. The available set of constants is defined
|
||||
* in the <code>DOMNodeFilter</code> interface. Nodes not accepted by
|
||||
* <code>whatToShow</code> will be skipped, but their children may still
|
||||
* be considered. Note that this skip takes precedence over the filter,
|
||||
* if any.
|
||||
* @since DOM Level 2
|
||||
*
|
||||
*/
|
||||
virtual DOMNodeFilter::ShowType getWhatToShow() = 0;
|
||||
|
||||
/**
|
||||
* The <code>DOMNodeFilter</code> used to screen nodes.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNodeFilter* getFilter() = 0;
|
||||
|
||||
/**
|
||||
* Return the expandEntityReferences flag.
|
||||
* The value of this flag determines whether the children of entity
|
||||
* reference nodes are visible to the <code>DOMNodeIterator</code>. If
|
||||
* false, these children and their descendants will be rejected. Note
|
||||
* that this rejection takes precedence over <code>whatToShow</code> and
|
||||
* the filter. Also note that this is currently the only situation where
|
||||
* <code>DOMNodeIterators</code> may reject a complete subtree rather than
|
||||
* skipping individual nodes.
|
||||
* <br>
|
||||
* <br> To produce a view of the document that has entity references
|
||||
* expanded and does not expose the entity reference node itself, use
|
||||
* the <code>whatToShow</code> flags to hide the entity reference node
|
||||
* and set <code>expandEntityReferences</code> to true when creating the
|
||||
* <code>DOMNodeIterator</code>. To produce a view of the document that has
|
||||
* entity reference nodes but no entity expansion, use the
|
||||
* <code>whatToShow</code> flags to show the entity reference node and
|
||||
* set <code>expandEntityReferences</code> to false.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual bool getExpandEntityReferences() = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Query methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns the next node in the set and advances the position of the
|
||||
* <code>DOMNodeIterator</code> in the set. After a
|
||||
* <code>DOMNodeIterator</code> is created, the first call to
|
||||
* <code>nextNode()</code> returns the first node in the set.
|
||||
* @return The next <code>DOMNode</code> in the set being iterated over, or
|
||||
* <code>null</code> if there are no more members in that set.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if this method is called after the
|
||||
* <code>detach</code> method was invoked.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode* nextNode() = 0;
|
||||
|
||||
/**
|
||||
* Returns the previous node in the set and moves the position of the
|
||||
* <code>DOMNodeIterator</code> backwards in the set.
|
||||
* @return The previous <code>DOMNode</code> in the set being iterated over,
|
||||
* or <code>null</code> if there are no more members in that set.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if this method is called after the
|
||||
* <code>detach</code> method was invoked.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode* previousNode() = 0;
|
||||
|
||||
/**
|
||||
* Detaches the <code>DOMNodeIterator</code> from the set which it iterated
|
||||
* over, releasing any computational resources and placing the
|
||||
* <code>DOMNodeIterator</code> in the INVALID state. After
|
||||
* <code>detach</code> has been invoked, calls to <code>nextNode</code>
|
||||
* or <code>previousNode</code> will raise the exception
|
||||
* INVALID_STATE_ERR.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void detach() = 0;
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard Extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard Extension */
|
||||
//@{
|
||||
/**
|
||||
* Called to indicate that this NodeIterator is no longer in use
|
||||
* and that the implementation may relinquish any resources associated with it.
|
||||
* (release() will call detach() where appropriate)
|
||||
*
|
||||
* Access to a released object will lead to unexpected result.
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
//@}
|
||||
};
|
||||
|
||||
#define GetDOMNodeIteratorMemoryManager GET_DIRECT_MM(fDocument)
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMNodeList.hpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMNODELIST_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMNODELIST_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMNode;
|
||||
|
||||
|
||||
/**
|
||||
* The <code>DOMNodeList</code> interface provides the abstraction of an ordered
|
||||
* collection of nodes. DOMNodeLists are created by DOMDocument::getElementsByTagName(),
|
||||
* DOMNode::getChildNodes(),
|
||||
*
|
||||
* <p>The items in the <code>DOMNodeList</code> are accessible via an integral
|
||||
* index, starting from 0.
|
||||
*
|
||||
* DOMNodeLists are "live", in that any changes to the document tree are immediately
|
||||
* reflected in any DOMNodeLists that may have been created for that tree.
|
||||
*/
|
||||
|
||||
class CDOM_EXPORT DOMNodeList {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMNodeList() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMNodeList(const DOMNodeList &);
|
||||
DOMNodeList & operator = (const DOMNodeList &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMNodeList() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMNodeList interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 1 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns the <code>index</code> item in the collection.
|
||||
*
|
||||
* If <code>index</code> is greater than or equal to the number of nodes in
|
||||
* the list, this returns <code>null</code>.
|
||||
*
|
||||
* @param index Index into the collection.
|
||||
* @return The node at the <code>index</code>th position in the
|
||||
* <code>DOMNodeList</code>, or <code>null</code> if that is not a valid
|
||||
* index.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMNode *item(XMLSize_t index) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of nodes in the list.
|
||||
*
|
||||
* The range of valid child node indices is 0 to <code>length-1</code> inclusive.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual XMLSize_t getLength() const = 0;
|
||||
//@}
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMNotation.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMNOTATION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMNOTATION_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* This interface represents a notation declared in the DTD. A notation either
|
||||
* declares, by name, the format of an unparsed entity (see section 4.7 of
|
||||
* the XML 1.0 specification), or is used for formal declaration of
|
||||
* Processing Instruction targets (see section 2.6 of the XML 1.0
|
||||
* specification). The <code>nodeName</code> attribute inherited from
|
||||
* <code>DOMNode</code> is set to the declared name of the notation.
|
||||
* <p>The DOM Level 1 does not support editing <code>DOMNotation</code> nodes;
|
||||
* they are therefore readonly.
|
||||
* <p>A <code>DOMNotation</code> node does not have any parent.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
class CDOM_EXPORT DOMNotation: public DOMNode {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMNotation() {}
|
||||
DOMNotation(const DOMNotation &other) : DOMNode(other) {}
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented operators */
|
||||
//@{
|
||||
DOMNotation & operator = (const DOMNotation &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMNotation() {};
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMNotation interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 1 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Get the public identifier of this notation.
|
||||
*
|
||||
* If the public identifier was not
|
||||
* specified, this is <code>null</code>.
|
||||
* @return Returns the public identifier of the notation
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh *getPublicId() const = 0;
|
||||
|
||||
/**
|
||||
* Get the system identifier of this notation.
|
||||
*
|
||||
* If the system identifier was not
|
||||
* specified, this is <code>null</code>.
|
||||
* @return Returns the system identifier of the notation
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh *getSystemId() const = 0;
|
||||
|
||||
|
||||
//@}
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMPSVITYPEINFO_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMPSVITYPEINFO_HPP
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Includes
|
||||
//------------------------------------------------------------------------------------
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* The <code>DOMPSVITypeInfo</code> interface represent the PSVI info used by
|
||||
* <code>DOMElement</code> or <code>DOMAttr</code> nodes, specified in the
|
||||
* schemas associated with the document.
|
||||
*/
|
||||
class CDOM_EXPORT DOMPSVITypeInfo
|
||||
{
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMPSVITypeInfo() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMPSVITypeInfo(const DOMPSVITypeInfo &);
|
||||
DOMPSVITypeInfo & operator = (const DOMPSVITypeInfo &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
|
||||
enum PSVIProperty
|
||||
{
|
||||
PSVI_Validity
|
||||
, PSVI_Validation_Attempted
|
||||
, PSVI_Type_Definition_Type
|
||||
, PSVI_Type_Definition_Name
|
||||
, PSVI_Type_Definition_Namespace
|
||||
, PSVI_Type_Definition_Anonymous
|
||||
, PSVI_Nil
|
||||
, PSVI_Member_Type_Definition_Name
|
||||
, PSVI_Member_Type_Definition_Namespace
|
||||
, PSVI_Member_Type_Definition_Anonymous
|
||||
, PSVI_Schema_Default
|
||||
, PSVI_Schema_Normalized_Value
|
||||
, PSVI_Schema_Specified
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMPSVITypeInfo() {};
|
||||
//@}
|
||||
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns the string value of the specified PSVI property associated to a
|
||||
* <code>DOMElement</code> or <code>DOMAttr</code>, or null if not available.
|
||||
*
|
||||
*
|
||||
* @return the string value of the specified PSVI property associated to a
|
||||
* <code>DOMElement</code> or <code>DOMAttr</code>, or null if not available.
|
||||
*/
|
||||
virtual const XMLCh* getStringProperty(PSVIProperty prop) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the numeric value of the specified PSVI property associated to a
|
||||
* <code>DOMElement</code> or <code>DOMAttr</code>, or null if not available.
|
||||
*
|
||||
*
|
||||
* @return the numeric value of the specified PSVI property associated to a
|
||||
* <code>DOMElement</code> or <code>DOMAttr</code>, or null if not available.
|
||||
*/
|
||||
virtual int getNumericProperty(PSVIProperty prop) const = 0;
|
||||
//@}
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* End of file DOMPSVITypeInfo.hpp
|
||||
*/
|
||||
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMProcessingInstruction.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMPROCESSINGINSTRUCTION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMPROCESSINGINSTRUCTION_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* The <code>DOMProcessingInstruction</code> interface represents a "processing
|
||||
* instruction", used in XML as a way to keep processor-specific information
|
||||
* in the text of the document.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
class CDOM_EXPORT DOMProcessingInstruction: public DOMNode {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMProcessingInstruction() {}
|
||||
DOMProcessingInstruction(const DOMProcessingInstruction &other) : DOMNode(other) {}
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented operators */
|
||||
//@{
|
||||
DOMProcessingInstruction & operator = (const DOMProcessingInstruction &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMProcessingInstruction() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMProcessingInstruction interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 1 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* The target of this processing instruction.
|
||||
*
|
||||
* XML defines this as being the
|
||||
* first token following the markup that begins the processing instruction.
|
||||
*
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh * getTarget() const = 0;
|
||||
|
||||
/**
|
||||
* The content of this processing instruction.
|
||||
*
|
||||
* This is from the first non
|
||||
* white space character after the target to the character immediately
|
||||
* preceding the <code>?></code>.
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual const XMLCh * getData() const = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the content of this processing instruction.
|
||||
*
|
||||
* This is from the first non
|
||||
* white space character after the target to the character immediately
|
||||
* preceding the <code>?></code>.
|
||||
* @param data The string containing the processing instruction
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual void setData(const XMLCh * data) = 0;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,530 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMRange.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMRANGE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMRANGE_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMNode;
|
||||
class DOMDocumentFragment;
|
||||
|
||||
/**
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
class CDOM_EXPORT DOMRange {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMRange() {}
|
||||
DOMRange(const DOMRange &) {}
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented operators */
|
||||
//@{
|
||||
DOMRange & operator = (const DOMRange &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMRange() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Class Types
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Public Constants */
|
||||
//@{
|
||||
/**
|
||||
* Constants CompareHow.
|
||||
*
|
||||
* <p><code>START_TO_START:</code>
|
||||
* Compare start boundary-point of <code>sourceRange</code> to start
|
||||
* boundary-point of Range on which <code>compareBoundaryPoints</code>
|
||||
* is invoked.</p>
|
||||
*
|
||||
* <p><code>START_TO_END:</code>
|
||||
* Compare start boundary-point of <code>sourceRange</code> to end
|
||||
* boundary-point of Range on which <code>compareBoundaryPoints</code>
|
||||
* is invoked.</p>
|
||||
*
|
||||
* <p><code>END_TO_END:</code>
|
||||
* Compare end boundary-point of <code>sourceRange</code> to end
|
||||
* boundary-point of Range on which <code>compareBoundaryPoints</code>
|
||||
* is invoked.</p>
|
||||
*
|
||||
* <p><code>END_TO_START:</code>
|
||||
* Compare end boundary-point of <code>sourceRange</code> to start
|
||||
* boundary-point of Range on which <code>compareBoundaryPoints</code>
|
||||
* is invoked.</p>
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
enum CompareHow {
|
||||
START_TO_START = 0,
|
||||
START_TO_END = 1,
|
||||
END_TO_END = 2,
|
||||
END_TO_START = 3
|
||||
};
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMRange interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 2 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* DOMNode within which the Range begins
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode* getStartContainer() const = 0;
|
||||
|
||||
/**
|
||||
* Offset within the starting node of the Range.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual XMLSize_t getStartOffset() const = 0;
|
||||
|
||||
/**
|
||||
* DOMNode within which the Range ends
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode* getEndContainer() const = 0;
|
||||
|
||||
/**
|
||||
* Offset within the ending node of the Range.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual XMLSize_t getEndOffset() const = 0;
|
||||
|
||||
/**
|
||||
* TRUE if the Range is collapsed
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual bool getCollapsed() const = 0;
|
||||
|
||||
/**
|
||||
* The deepest common ancestor container of the Range's two
|
||||
* boundary-points.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual const DOMNode* getCommonAncestorContainer() const = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the attributes describing the start of the Range.
|
||||
* @param refNode The <code>refNode</code> value. This parameter must be
|
||||
* different from <code>null</code>.
|
||||
* @param offset The <code>startOffset</code> value.
|
||||
* @exception DOMRangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if <code>refNode</code> or an ancestor
|
||||
* of <code>refNode</code> is an DOMEntity, DOMNotation, or DOMDocumentType
|
||||
* node.
|
||||
* @exception DOMException
|
||||
* INDEX_SIZE_ERR: Raised if <code>offset</code> is negative or greater
|
||||
* than the number of child units in <code>refNode</code>. Child units
|
||||
* are 16-bit units if <code>refNode</code> is a type of DOMCharacterData
|
||||
* node (e.g., a DOMText or DOMComment node) or a DOMProcessingInstruction
|
||||
* node. Child units are Nodes in all other cases.
|
||||
* <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
|
||||
* been invoked on this object.
|
||||
* <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
|
||||
* from a different document than the one that created this range.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void setStart(const DOMNode *refNode, XMLSize_t offset) = 0;
|
||||
|
||||
/**
|
||||
* Sets the attributes describing the end of a Range.
|
||||
* @param refNode The <code>refNode</code> value. This parameter must be
|
||||
* different from <code>null</code>.
|
||||
* @param offset The <code>endOffset</code> value.
|
||||
* @exception DOMRangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if <code>refNode</code> or an ancestor
|
||||
* of <code>refNode</code> is an DOMEntity, DOMNotation, or DOMDocumentType
|
||||
* node.
|
||||
* @exception DOMException
|
||||
* INDEX_SIZE_ERR: Raised if <code>offset</code> is negative or greater
|
||||
* than the number of child units in <code>refNode</code>. Child units
|
||||
* are 16-bit units if <code>refNode</code> is a type of DOMCharacterData
|
||||
* node (e.g., a DOMText or DOMComment node) or a DOMProcessingInstruction
|
||||
* node. Child units are Nodes in all other cases.
|
||||
* <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
|
||||
* been invoked on this object.
|
||||
* <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
|
||||
* from a different document than the one that created this range.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void setEnd(const DOMNode *refNode, XMLSize_t offset) = 0;
|
||||
|
||||
/**
|
||||
* Sets the start position to be before a node
|
||||
* @param refNode Range starts before <code>refNode</code>
|
||||
* @exception DOMRangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if the root container of
|
||||
* <code>refNode</code> is not an DOMAttr, DOMDocument, or DOMDocumentFragment
|
||||
* node or if <code>refNode</code> is a DOMDocument, DOMDocumentFragment,
|
||||
* DOMAttr, DOMEntity, or DOMNotation node.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
* <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
|
||||
* from a different document than the one that created this range.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void setStartBefore(const DOMNode *refNode) = 0;
|
||||
|
||||
/**
|
||||
* Sets the start position to be after a node
|
||||
* @param refNode Range starts after <code>refNode</code>
|
||||
* @exception DOMRangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if the root container of
|
||||
* <code>refNode</code> is not an DOMAttr, DOMDocument, or DOMDocumentFragment
|
||||
* node or if <code>refNode</code> is a DOMDocument, DOMDocumentFragment,
|
||||
* DOMAttr, DOMEntity, or DOMNotation node.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
* <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
|
||||
* from a different document than the one that created this range.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void setStartAfter(const DOMNode *refNode) = 0;
|
||||
|
||||
/**
|
||||
* Sets the end position to be before a node.
|
||||
* @param refNode Range ends before <code>refNode</code>
|
||||
* @exception DOMRangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if the root container of
|
||||
* <code>refNode</code> is not an DOMAttr, DOMDocument, or DOMDocumentFragment
|
||||
* node or if <code>refNode</code> is a DOMDocument, DOMDocumentFragment,
|
||||
* DOMAttr, DOMEntity, or DOMNotation node.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
* <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
|
||||
* from a different document than the one that created this range.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void setEndBefore(const DOMNode *refNode) = 0;
|
||||
|
||||
/**
|
||||
* Sets the end of a Range to be after a node
|
||||
* @param refNode Range ends after <code>refNode</code>.
|
||||
* @exception DOMRangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if the root container of
|
||||
* <code>refNode</code> is not a DOMAttr, DOMDocument or DOMDocumentFragment
|
||||
* node or if <code>refNode</code> is a DOMDocument, DOMDocumentFragment,
|
||||
* DOMAttr, DOMEntity, or DOMNotation node.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
* <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
|
||||
* from a different document than the one that created this range.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void setEndAfter(const DOMNode *refNode) = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Misc methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Collapse a Range onto one of its boundary-points
|
||||
* @param toStart If TRUE, collapses the Range onto its start; if FALSE,
|
||||
* collapses it onto its end.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void collapse(bool toStart) = 0;
|
||||
|
||||
/**
|
||||
* Select a node and its contents
|
||||
* @param refNode The node to select.
|
||||
* @exception DOMRangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if an ancestor of <code>refNode</code>
|
||||
* is an DOMEntity, DOMNotation or DOMDocumentType node or if
|
||||
* <code>refNode</code> is a DOMDocument, DOMDocumentFragment, DOMAttr, DOMEntity,
|
||||
* or DOMNotation node.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
* <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
|
||||
* from a different document than the one that created this range.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void selectNode(const DOMNode *refNode) = 0;
|
||||
|
||||
/**
|
||||
* Select the contents within a node
|
||||
* @param refNode DOMNode to select from
|
||||
* @exception DOMRangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if <code>refNode</code> or an ancestor
|
||||
* of <code>refNode</code> is an DOMEntity, DOMNotation or DOMDocumentType node.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
* <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
|
||||
* from a different document than the one that created this range.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void selectNodeContents(const DOMNode *refNode) = 0;
|
||||
|
||||
/**
|
||||
* Compare the boundary-points of two Ranges in a document.
|
||||
* @param how A code representing the type of comparison, as defined
|
||||
* above.
|
||||
* @param sourceRange The <code>Range</code> on which this current
|
||||
* <code>Range</code> is compared to.
|
||||
* @return -1, 0 or 1 depending on whether the corresponding
|
||||
* boundary-point of the Range is respectively before, equal to, or
|
||||
* after the corresponding boundary-point of <code>sourceRange</code>.
|
||||
* @exception DOMException
|
||||
* WRONG_DOCUMENT_ERR: Raised if the two Ranges are not in the same
|
||||
* DOMDocument or DOMDocumentFragment.
|
||||
* <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
|
||||
* been invoked on this object.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual short compareBoundaryPoints(CompareHow how, const DOMRange* sourceRange) const = 0;
|
||||
|
||||
/**
|
||||
* Removes the contents of a Range from the containing document or
|
||||
* document fragment without returning a reference to the removed
|
||||
* content.
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the content of
|
||||
* the Range is read-only or any of the nodes that contain any of the
|
||||
* content of the Range are read-only.
|
||||
* <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
|
||||
* been invoked on this object.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void deleteContents() = 0;
|
||||
|
||||
/**
|
||||
* Moves the contents of a Range from the containing document or document
|
||||
* fragment to a new DOMDocumentFragment.
|
||||
* @return A DOMDocumentFragment containing the extracted contents.
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the content of
|
||||
* the Range is read-only or any of the nodes which contain any of the
|
||||
* content of the Range are read-only.
|
||||
* <br>HIERARCHY_REQUEST_ERR: Raised if a DOMDocumentType node would be
|
||||
* extracted into the new DOMDocumentFragment.
|
||||
* <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
|
||||
* been invoked on this object.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMDocumentFragment* extractContents() = 0;
|
||||
|
||||
/**
|
||||
* Duplicates the contents of a Range
|
||||
* @return A DOMDocumentFragment that contains content equivalent to this
|
||||
* Range.
|
||||
* @exception DOMException
|
||||
* HIERARCHY_REQUEST_ERR: Raised if a DOMDocumentType node would be
|
||||
* extracted into the new DOMDocumentFragment.
|
||||
* <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
|
||||
* been invoked on this object.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMDocumentFragment* cloneContents() const = 0;
|
||||
|
||||
/**
|
||||
* Inserts a node into the DOMDocument or DOMDocumentFragment at the start of
|
||||
* the Range. If the container is a DOMText node, this will be split at the
|
||||
* start of the Range (as if the DOMText node's splitText method was
|
||||
* performed at the insertion point) and the insertion will occur
|
||||
* between the two resulting DOMText nodes. Adjacent DOMText nodes will not be
|
||||
* automatically merged. If the node to be inserted is a
|
||||
* DOMDocumentFragment node, the children will be inserted rather than the
|
||||
* DOMDocumentFragment node itself.
|
||||
* @param newNode The node to insert at the start of the Range
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of the
|
||||
* start of the Range is read-only.
|
||||
* <br>WRONG_DOCUMENT_ERR: Raised if <code>newNode</code> and the
|
||||
* container of the start of the Range were not created from the same
|
||||
* document.
|
||||
* <br>HIERARCHY_REQUEST_ERR: Raised if the container of the start of
|
||||
* the Range is of a type that does not allow children of the type of
|
||||
* <code>newNode</code> or if <code>newNode</code> is an ancestor of
|
||||
* the container.
|
||||
* <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
|
||||
* been invoked on this object.
|
||||
* @exception DOMRangeException
|
||||
* INVALID_NODE_TYPE_ERR: Raised if <code>newNode</code> is an DOMAttr,
|
||||
* DOMEntity, DOMNotation, or DOMDocument node.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void insertNode(DOMNode *newNode) = 0;
|
||||
|
||||
/**
|
||||
* Reparents the contents of the Range to the given node and inserts the
|
||||
* node at the position of the start of the Range.
|
||||
* @param newParent The node to surround the contents with.
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of
|
||||
* either boundary-point of the Range is read-only.
|
||||
* <br>WRONG_DOCUMENT_ERR: Raised if <code> newParent</code> and the
|
||||
* container of the start of the Range were not created from the same
|
||||
* document.
|
||||
* <br>HIERARCHY_REQUEST_ERR: Raised if the container of the start of
|
||||
* the Range is of a type that does not allow children of the type of
|
||||
* <code>newParent</code> or if <code>newParent</code> is an ancestor
|
||||
* of the container or if <code>node</code> would end up with a child
|
||||
* node of a type not allowed by the type of <code>node</code>.
|
||||
* <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
|
||||
* been invoked on this object.
|
||||
* @exception DOMRangeException
|
||||
* BAD_BOUNDARYPOINTS_ERR: Raised if the Range partially selects a
|
||||
* non-text node.
|
||||
* <br>INVALID_NODE_TYPE_ERR: Raised if <code> node</code> is an DOMAttr,
|
||||
* DOMEntity, DOMDocumentType, DOMNotation, DOMDocument, or DOMDocumentFragment node.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void surroundContents(DOMNode *newParent) = 0;
|
||||
|
||||
/**
|
||||
* Produces a new Range whose boundary-points are equal to the
|
||||
* boundary-points of the Range.
|
||||
* @return The duplicated Range.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMRange* cloneRange() const = 0;
|
||||
|
||||
/**
|
||||
* Returns the contents of a Range as a string. This string contains only
|
||||
* the data characters, not any markup.
|
||||
* @return The contents of the Range.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual const XMLCh* toString() const = 0;
|
||||
|
||||
/**
|
||||
* Called to indicate that the Range is no longer in use and that the
|
||||
* implementation may relinquish any resources associated with this
|
||||
* Range. Subsequent calls to any methods or attribute getters on this
|
||||
* Range will result in a <code>DOMException</code> being thrown with an
|
||||
* error code of <code>INVALID_STATE_ERR</code>.
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
|
||||
* invoked on this object.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void detach() = 0;
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard Extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard Extension */
|
||||
//@{
|
||||
/**
|
||||
* Called to indicate that this Range is no longer in use
|
||||
* and that the implementation may relinquish any resources associated with it.
|
||||
* (release() will call detach() where appropriate)
|
||||
*
|
||||
* Access to a released object will lead to unexpected result.
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
//@}
|
||||
};
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMRangeException.cpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#include "DOMRangeException.hpp"
|
||||
#include <xercesc/util/XMLDOMMsg.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
DOMRangeException::DOMRangeException()
|
||||
: DOMException()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DOMRangeException::DOMRangeException(short exCode,
|
||||
short messageCode,
|
||||
MemoryManager* const memoryManager)
|
||||
: DOMException(exCode, messageCode?messageCode:XMLDOMMsg::DOMRANGEEXCEPTION_ERRX+exCode-DOMRangeException::BAD_BOUNDARYPOINTS_ERR+1, memoryManager)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DOMRangeException::DOMRangeException(const DOMRangeException &other)
|
||||
: DOMException(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DOMRangeException::~DOMRangeException()
|
||||
{
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMRangeException.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMRANGEEXCEPTION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMRANGEEXCEPTION_HPP
|
||||
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* Range operations may throw a <code>DOMRangeException</code> as specified in
|
||||
* their method descriptions.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
|
||||
class CDOM_EXPORT DOMRangeException : public DOMException {
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Class Types
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Public Constants */
|
||||
//@{
|
||||
/**
|
||||
* Enumerators for DOM Range Exceptions
|
||||
*
|
||||
* <p><code>BAD_BOUNDARYPOINTS_ERR:</code>
|
||||
* If the boundary-points of a Range do not meet specific requirements.</p>
|
||||
*
|
||||
* <p><code>INVALID_NODE_TYPE_ERR:</code>
|
||||
* If the container of an boundary-point of a Range is being set to either
|
||||
* a node of an invalid type or a node with an ancestor of an invalid
|
||||
* type.</p>
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
enum RangeExceptionCode {
|
||||
BAD_BOUNDARYPOINTS_ERR = 111,
|
||||
INVALID_NODE_TYPE_ERR = 112
|
||||
};
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
/**
|
||||
* Default constructor for DOMRangeException.
|
||||
*
|
||||
*/
|
||||
DOMRangeException();
|
||||
|
||||
/**
|
||||
* Constructor which takes an error code and a message.
|
||||
*
|
||||
* @param code The error code which indicates the exception
|
||||
* @param messageCode The string containing the error message
|
||||
* @param memoryManager The memory manager used to (de)allocate memory
|
||||
*/
|
||||
DOMRangeException(short code,
|
||||
short messageCode,
|
||||
MemoryManager* const memoryManager);
|
||||
|
||||
/**
|
||||
* Copy constructor.
|
||||
*
|
||||
* @param other The object to be copied.
|
||||
*/
|
||||
DOMRangeException(const DOMRangeException &other);
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Destructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor. */
|
||||
//@{
|
||||
/**
|
||||
* Destructor for DOMRangeException.
|
||||
*
|
||||
*/
|
||||
virtual ~DOMRangeException();
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMRangeException & operator = (const DOMRangeException &);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMStringList.hpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMSTRINGLIST_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMSTRINGLIST_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* The <code>DOMStringList</code> interface provides the abstraction of an ordered
|
||||
* collection of strings, without defining or constraining how this collection
|
||||
* is implemented. The items in the <code>DOMStringList</code> are accessible via
|
||||
* an integral index, starting from 0.
|
||||
*/
|
||||
|
||||
class CDOM_EXPORT DOMStringList {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMStringList() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMStringList(const DOMStringList &);
|
||||
DOMStringList & operator = (const DOMStringList &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMStringList() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMStringList interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns the <code>index</code> item in the collection.
|
||||
*
|
||||
* If <code>index</code> is greater than or equal to the number of strings in
|
||||
* the list, this returns <code>null</code>.
|
||||
*
|
||||
* @param index Index into the collection.
|
||||
* @return The string at the <code>index</code>th position in the
|
||||
* <code>DOMStringList</code>, or <code>null</code> if that is not a valid
|
||||
* index.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh *item(XMLSize_t index) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of strings in the list.
|
||||
*
|
||||
* The range of valid child node indices is 0 to <code>length-1</code> inclusive.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual XMLSize_t getLength() const = 0;
|
||||
|
||||
/**
|
||||
* Test if a string is part of this DOMStringList
|
||||
*
|
||||
* @return <code>true</code> if the string has been found, <code>false</code> otherwise.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual bool contains(const XMLCh*) const = 0;
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard Extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard Extension */
|
||||
//@{
|
||||
/**
|
||||
* Called to indicate that this list is no longer in use
|
||||
* and that the implementation may relinquish any resources associated with it and
|
||||
* its associated children.
|
||||
*
|
||||
* Access to a released object will lead to unexpected result.
|
||||
*
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMText.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMTEXT_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMTEXT_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMCharacterData.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* The <code>DOMText</code> interface inherits from <code>DOMCharacterData</code>
|
||||
* and represents the textual content (termed character data in XML) of an
|
||||
* <code>DOMElement</code> or <code>DOMAttr</code>. If there is no markup inside
|
||||
* an element's content, the text is contained in a single object
|
||||
* implementing the <code>DOMText</code> interface that is the only child of
|
||||
* the element. If there is markup, it is parsed into the information items
|
||||
* (elements, comments, etc.) and <code>DOMText</code> nodes that form the list
|
||||
* of children of the element.
|
||||
* <p>When a document is first made available via the DOM, there is only one
|
||||
* <code>DOMText</code> node for each block of text. Users may create adjacent
|
||||
* <code>DOMText</code> nodes that represent the contents of a given element
|
||||
* without any intervening markup, but should be aware that there is no way
|
||||
* to represent the separations between these nodes in XML or HTML, so they
|
||||
* will not (in general) persist between DOM editing sessions. The
|
||||
* <code>normalize()</code> method on <code>DOMNode</code> merges any such
|
||||
* adjacent <code>DOMText</code> objects into a single node for each block of
|
||||
* text.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
|
||||
*/
|
||||
class CDOM_EXPORT DOMText: public DOMCharacterData {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMText() {}
|
||||
DOMText(const DOMText &other) : DOMCharacterData(other) {}
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented operators */
|
||||
//@{
|
||||
DOMText & operator = (const DOMText &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMText() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMText interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 1 */
|
||||
//@{
|
||||
/**
|
||||
* Breaks this node into two nodes at the specified <code>offset</code>,
|
||||
* keeping both in the tree as siblings. After being split, this node
|
||||
* will contain all the content up to the <code>offset</code> point. A
|
||||
* new node of the same type, which contains all the content at and
|
||||
* after the <code>offset</code> point, is returned. If the original
|
||||
* node had a parent node, the new node is inserted as the next sibling
|
||||
* of the original node. When the <code>offset</code> is equal to the
|
||||
* length of this node, the new node has no data.
|
||||
* @param offset The 16-bit unit offset at which to split, starting from
|
||||
* <code>0</code>.
|
||||
* @return The new node, of the same type as this node.
|
||||
* @exception DOMException
|
||||
* INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
|
||||
* than the number of 16-bit units in <code>data</code>.
|
||||
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
|
||||
* @since DOM Level 1
|
||||
*/
|
||||
virtual DOMText *splitText(XMLSize_t offset) = 0;
|
||||
//@}
|
||||
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
/**
|
||||
* Returns whether this text node contains element content whitespace,
|
||||
* often abusively called "ignorable whitespace". The text node is determined
|
||||
* to contain whitespace in element content during the load of the document
|
||||
* or if validation occurs while using <code>DOMDocument::normalizeDocument()</code>.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual bool getIsElementContentWhitespace() const = 0;
|
||||
|
||||
/**
|
||||
* Returns all text of <code>DOMText</code> nodes logically-adjacent text
|
||||
* nodes to this node, concatenated in document order.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual const XMLCh* getWholeText() const = 0;
|
||||
|
||||
/**
|
||||
* Substitutes the a specified text for the text of the current node and
|
||||
* all logically-adjacent text nodes.
|
||||
*
|
||||
* <br>This method returns the node in the hierarchy which received the
|
||||
* replacement text, which is null if the text was empty or is the
|
||||
* current node if the current node is not read-only or otherwise is a
|
||||
* new node of the same type as the current node inserted at the site of
|
||||
* the replacement. All logically-adjacent text nodes are removed
|
||||
* including the current node unless it was the recipient of the
|
||||
* replacement text.
|
||||
* <br>Where the nodes to be removed are read-only descendants of an
|
||||
* <code>DOMEntityReference</code>, the <code>DOMEntityReference</code> must
|
||||
* be removed instead of the read-only nodes. If any
|
||||
* <code>DOMEntityReference</code> to be removed has descendants that are
|
||||
* not <code>DOMEntityReference</code>, <code>DOMText</code>, or
|
||||
* <code>DOMCDATASection</code> nodes, the <code>replaceWholeText</code>
|
||||
* method must fail before performing any modification of the document,
|
||||
* raising a <code>DOMException</code> with the code
|
||||
* <code>NO_MODIFICATION_ALLOWED_ERR</code>.
|
||||
*
|
||||
* @param content The content of the replacing <code>DOMText</code> node.
|
||||
* @return The <code>DOMText</code> node created with the specified content.
|
||||
* @exception DOMException
|
||||
* NO_MODIFICATION_ALLOWED_ERR: Raised if one of the <code>DOMText</code>
|
||||
* nodes being replaced is readonly.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMText* replaceWholeText(const XMLCh* content) = 0;
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard extension */
|
||||
//@{
|
||||
/**
|
||||
* Non-standard extension
|
||||
*
|
||||
* Return true if this node contains ignorable whitespaces only.
|
||||
* @return True if this node contains ignorable whitespaces only.
|
||||
*/
|
||||
virtual bool isIgnorableWhitespace() const = 0;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMTreeWalker.hpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMTREEWALKER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMTREEWALKER_HPP
|
||||
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
#include <xercesc/dom/DOMNodeFilter.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* <code>DOMTreeWalker</code> objects are used to navigate a document tree or
|
||||
* subtree using the view of the document defined by their
|
||||
* <code>whatToShow</code> flags and filter (if any). Any function which
|
||||
* performs navigation using a <code>DOMTreeWalker</code> will automatically
|
||||
* support any view defined by a <code>DOMTreeWalker</code>.
|
||||
* <p>Omitting nodes from the logical view of a subtree can result in a
|
||||
* structure that is substantially different from the same subtree in the
|
||||
* complete, unfiltered document. Nodes that are siblings in the
|
||||
* <code>DOMTreeWalker</code> view may be children of different, widely
|
||||
* separated nodes in the original view. For instance, consider a
|
||||
* <code>DOMNodeFilter</code> that skips all nodes except for DOMText nodes and
|
||||
* the root node of a document. In the logical view that results, all text
|
||||
* nodes will be siblings and appear as direct children of the root node, no
|
||||
* matter how deeply nested the structure of the original document.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
class CDOM_EXPORT DOMTreeWalker {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMTreeWalker() {}
|
||||
DOMTreeWalker(const DOMTreeWalker &) {}
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMTreeWalker & operator = (const DOMTreeWalker &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMTreeWalker() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMTreeWalker interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 2 */
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* The <code>root</code> node of the <code>DOMTreeWalker</code>, as specified
|
||||
* when it was created.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode* getRoot() = 0;
|
||||
/**
|
||||
* This attribute determines which node types are presented via the
|
||||
* <code>DOMTreeWalker</code>. The available set of constants is defined in
|
||||
* the <code>DOMNodeFilter</code> interface. Nodes not accepted by
|
||||
* <code>whatToShow</code> will be skipped, but their children may still
|
||||
* be considered. Note that this skip takes precedence over the filter,
|
||||
* if any.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNodeFilter::ShowType getWhatToShow()= 0;
|
||||
|
||||
/**
|
||||
* Return The filter used to screen nodes.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNodeFilter* getFilter()= 0;
|
||||
|
||||
/**
|
||||
* The value of this flag determines whether the children of entity
|
||||
* reference nodes are visible to the <code>DOMTreeWalker</code>. If false,
|
||||
* these children and their descendants will be rejected. Note that
|
||||
* this rejection takes precedence over <code>whatToShow</code> and the
|
||||
* filter, if any.
|
||||
* <br> To produce a view of the document that has entity references
|
||||
* expanded and does not expose the entity reference node itself, use
|
||||
* the <code>whatToShow</code> flags to hide the entity reference node
|
||||
* and set <code>expandEntityReferences</code> to true when creating the
|
||||
* <code>DOMTreeWalker</code>. To produce a view of the document that has
|
||||
* entity reference nodes but no entity expansion, use the
|
||||
* <code>whatToShow</code> flags to show the entity reference node and
|
||||
* set <code>expandEntityReferences</code> to false.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual bool getExpandEntityReferences()= 0;
|
||||
|
||||
/**
|
||||
* Return the node at which the DOMTreeWalker is currently positioned.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode* getCurrentNode()= 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Query methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Moves to and returns the closest visible ancestor node of the current
|
||||
* node. If the search for <code>parentNode</code> attempts to step
|
||||
* upward from the <code>DOMTreeWalker</code>'s <code>root</code> node, or
|
||||
* if it fails to find a visible ancestor node, this method retains the
|
||||
* current position and returns <code>null</code>.
|
||||
* @return The new parent node, or <code>null</code> if the current node
|
||||
* has no parent in the <code>DOMTreeWalker</code>'s logical view.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode* parentNode()= 0;
|
||||
|
||||
/**
|
||||
* Moves the <code>DOMTreeWalker</code> to the first visible child of the
|
||||
* current node, and returns the new node. If the current node has no
|
||||
* visible children, returns <code>null</code>, and retains the current
|
||||
* node.
|
||||
* @return The new node, or <code>null</code> if the current node has no
|
||||
* visible children in the <code>DOMTreeWalker</code>'s logical view.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode* firstChild()= 0;
|
||||
|
||||
/**
|
||||
* Moves the <code>DOMTreeWalker</code> to the last visible child of the
|
||||
* current node, and returns the new node. If the current node has no
|
||||
* visible children, returns <code>null</code>, and retains the current
|
||||
* node.
|
||||
* @return The new node, or <code>null</code> if the current node has no
|
||||
* children in the <code>DOMTreeWalker</code>'s logical view.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode* lastChild()= 0;
|
||||
|
||||
/**
|
||||
* Moves the <code>DOMTreeWalker</code> to the previous sibling of the
|
||||
* current node, and returns the new node. If the current node has no
|
||||
* visible previous sibling, returns <code>null</code>, and retains the
|
||||
* current node.
|
||||
* @return The new node, or <code>null</code> if the current node has no
|
||||
* previous sibling. in the <code>DOMTreeWalker</code>'s logical view.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode* previousSibling()= 0;
|
||||
|
||||
/**
|
||||
* Moves the <code>DOMTreeWalker</code> to the next sibling of the current
|
||||
* node, and returns the new node. If the current node has no visible
|
||||
* next sibling, returns <code>null</code>, and retains the current node.
|
||||
* @return The new node, or <code>null</code> if the current node has no
|
||||
* next sibling. in the <code>DOMTreeWalker</code>'s logical view.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode* nextSibling()= 0;
|
||||
|
||||
/**
|
||||
* Moves the <code>DOMTreeWalker</code> to the previous visible node in
|
||||
* document order relative to the current node, and returns the new
|
||||
* node. If the current node has no previous node, or if the search for
|
||||
* <code>previousNode</code> attempts to step upward from the
|
||||
* <code>DOMTreeWalker</code>'s <code>root</code> node, returns
|
||||
* <code>null</code>, and retains the current node.
|
||||
* @return The new node, or <code>null</code> if the current node has no
|
||||
* previous node in the <code>DOMTreeWalker</code>'s logical view.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode* previousNode()= 0;
|
||||
|
||||
/**
|
||||
* Moves the <code>DOMTreeWalker</code> to the next visible node in document
|
||||
* order relative to the current node, and returns the new node. If the
|
||||
* current node has no next node, or if the search for nextNode attempts
|
||||
* to step upward from the <code>DOMTreeWalker</code>'s <code>root</code>
|
||||
* node, returns <code>null</code>, and retains the current node.
|
||||
* @return The new node, or <code>null</code> if the current node has no
|
||||
* next node in the <code>DOMTreeWalker</code>'s logical view.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual DOMNode* nextNode()= 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* The node at which the <code>DOMTreeWalker</code> is currently positioned.
|
||||
* <br>Alterations to the DOM tree may cause the current node to no longer
|
||||
* be accepted by the <code>DOMTreeWalker</code>'s associated filter.
|
||||
* <code>currentNode</code> may also be explicitly set to any node,
|
||||
* whether or not it is within the subtree specified by the
|
||||
* <code>root</code> node or would be accepted by the filter and
|
||||
* <code>whatToShow</code> flags. Further traversal occurs relative to
|
||||
* <code>currentNode</code> even if it is not part of the current view,
|
||||
* by applying the filters in the requested direction; if no traversal
|
||||
* is possible, <code>currentNode</code> is not changed.
|
||||
* @exception DOMException
|
||||
* NOT_SUPPORTED_ERR: Raised if an attempt is made to set
|
||||
* <code>currentNode</code> to <code>null</code>.
|
||||
*
|
||||
* @since DOM Level 2
|
||||
*/
|
||||
virtual void setCurrentNode(DOMNode* currentNode)= 0;
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard Extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard Extension */
|
||||
//@{
|
||||
/**
|
||||
* Called to indicate that this TreeWalker is no longer in use
|
||||
* and that the implementation may relinquish any resources associated with it.
|
||||
*
|
||||
* Access to a released object will lead to unexpected result.
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
//@}
|
||||
};
|
||||
|
||||
#define GetDOMTreeWalkerMemoryManager GET_INDIRECT_MM(fCurrentNode)
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMTYPEINFO_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMTYPEINFO_HPP
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Includes
|
||||
//------------------------------------------------------------------------------------
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* The <code>DOMTypeInfo</code> interface represent a type used by
|
||||
* <code>DOMElement</code> or <code>DOMAttr</code> nodes, specified in the
|
||||
* schemas associated with the document. The type is a pair of a namespace URI
|
||||
* and name properties, and depends on the document's schema.
|
||||
*/
|
||||
class CDOM_EXPORT DOMTypeInfo
|
||||
{
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMTypeInfo() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMTypeInfo(const DOMTypeInfo &);
|
||||
DOMTypeInfo & operator = (const DOMTypeInfo &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMTypeInfo() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Class Types
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Public Contants */
|
||||
//@{
|
||||
/**
|
||||
* These are the available values for the derivationMethod parameter used by the
|
||||
* method <code>DOMTypeInfo::isDerivedFrom()</code>. It is a set of possible types
|
||||
* of derivation, and the values represent bit positions. If a bit in the derivationMethod
|
||||
* parameter is set to 1, the corresponding type of derivation will be taken into account
|
||||
* when evaluating the derivation between the reference type definition and the other type
|
||||
* definition. When using the isDerivedFrom method, combining all of them in the
|
||||
* derivationMethod parameter is equivalent to invoking the method for each of them separately
|
||||
* and combining the results with the OR boolean function. This specification only defines
|
||||
* the type of derivation for XML Schema.
|
||||
*
|
||||
* In addition to the types of derivation listed below, please note that:
|
||||
* - any type derives from xsd:anyType.
|
||||
* - any simple type derives from xsd:anySimpleType by restriction.
|
||||
* - any complex type does not derive from xsd:anySimpleType by restriction.
|
||||
*
|
||||
* <p><code>DERIVATION_EXTENSION:</code>
|
||||
* If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the
|
||||
* derivation by extension. The reference type definition is derived by extension from the other
|
||||
* type definition if the other type definition can be reached recursively following the
|
||||
* {base type definition} property from the reference type definition, and at least one of the
|
||||
* derivation methods involved is an extension.</p>
|
||||
*
|
||||
* <p><code>DERIVATION_LIST:</code>
|
||||
* If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the list.
|
||||
* The reference type definition is derived by list from the other type definition if there exists
|
||||
* two type definitions T1 and T2 such as the reference type definition is derived from T1 by
|
||||
* DERIVATION_RESTRICTION or DERIVATION_EXTENSION, T2 is derived from the other type definition by
|
||||
* DERIVATION_RESTRICTION, T1 has {variety} list, and T2 is the {item type definition}. Note that
|
||||
* T1 could be the same as the reference type definition, and T2 could be the same as the other
|
||||
* type definition.</p>
|
||||
*
|
||||
* <p><code>DERIVATION_RESTRICTION:</code>
|
||||
* If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the
|
||||
* derivation by restriction if complex types are involved, or a restriction if simple types are
|
||||
* involved.
|
||||
* The reference type definition is derived by restriction from the other type definition if the
|
||||
* other type definition is the same as the reference type definition, or if the other type definition
|
||||
* can be reached recursively following the {base type definition} property from the reference type
|
||||
* definition, and all the derivation methods involved are restriction.</p>
|
||||
*
|
||||
* <p><code>DERIVATION_UNION:</code>
|
||||
* If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the union
|
||||
* if simple types are involved.
|
||||
* The reference type definition is derived by union from the other type definition if there exists
|
||||
* two type definitions T1 and T2 such as the reference type definition is derived from T1 by
|
||||
* DERIVATION_RESTRICTION or DERIVATION_EXTENSION, T2 is derived from the other type definition by
|
||||
* DERIVATION_RESTRICTION, T1 has {variety} union, and one of the {member type definitions} is T2.
|
||||
* Note that T1 could be the same as the reference type definition, and T2 could be the same as the
|
||||
* other type definition.</p>
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*
|
||||
*/
|
||||
enum DerivationMethods {
|
||||
DERIVATION_RESTRICTION = 0x001,
|
||||
DERIVATION_EXTENSION = 0x002,
|
||||
DERIVATION_UNION = 0x004,
|
||||
DERIVATION_LIST = 0x008
|
||||
};
|
||||
//@}
|
||||
|
||||
//@{
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns The name of a type declared for the associated <code>DOMElement</code>
|
||||
* or <code>DOMAttr</code>, or null if unknown.
|
||||
*
|
||||
* @return The name of a type declared for the associated <code>DOMElement</code>
|
||||
* or <code>DOMAttribute</code>, or null if unknown.
|
||||
* @since DOM level 3
|
||||
*/
|
||||
virtual const XMLCh* getTypeName() const = 0;
|
||||
|
||||
/**
|
||||
* The namespace of the type declared for the associated <code>DOMElement</code>
|
||||
* or <code>DOMAttr</code> or null if the <code>DOMElement</code> does not have
|
||||
* declaration or if no namespace information is available.
|
||||
*
|
||||
* @return The namespace of the type declared for the associated <code>DOMElement</code>
|
||||
* or <code>DOMAttr</code> or null if the <code>DOMElement</code> does not have
|
||||
* declaration or if no namespace information is available.
|
||||
* @since DOM level 3
|
||||
*/
|
||||
virtual const XMLCh* getTypeNamespace() const = 0;
|
||||
//@}
|
||||
|
||||
//@{
|
||||
/**
|
||||
* This method returns if there is a derivation between the reference type definition,
|
||||
* i.e. the DOMTypeInfo on which the method is being called, and the other type definition,
|
||||
* i.e. the one passed as parameters.
|
||||
*
|
||||
* @param typeNamespaceArg The namespace of the other type definition.
|
||||
* @param typeNameArg The name of the other type definition.
|
||||
* @param derivationMethod The type of derivation and conditions applied between two types,
|
||||
* as described in the list of constants provided in this interface.
|
||||
* @return If the document's schema is a DTD or no schema is associated with the document,
|
||||
* this method will always return false.
|
||||
* If the document's schema is an XML Schema, the method will true if the reference
|
||||
* type definition is derived from the other type definition according to the derivation
|
||||
* parameter. If the value of the parameter is 0 (no bit is set to 1 for the
|
||||
* derivationMethod parameter), the method will return true if the other type definition
|
||||
* can be reached by recursing any combination of {base type definition},
|
||||
* {item type definition}, or {member type definitions} from the reference type definition.
|
||||
* @since DOM level 3
|
||||
*/
|
||||
virtual bool isDerivedFrom(const XMLCh* typeNamespaceArg,
|
||||
const XMLCh* typeNameArg,
|
||||
DerivationMethods derivationMethod) const = 0;
|
||||
//@}
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* End of file DOMTypeInfo.hpp
|
||||
*/
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMUserDataHandler.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMUSERDATAHANDLER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMUSERDATAHANDLER_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* When associating an object to a key on a node using <code>setUserData</code>
|
||||
* the application can provide a handler that gets called when the node the
|
||||
* object is associated to is being cloned or imported. This can be used by
|
||||
* the application to implement various behaviors regarding the data it
|
||||
* associates to the DOM nodes. This interface defines that handler.
|
||||
*
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
class CDOM_EXPORT DOMUserDataHandler {
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMUserDataHandler() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMUserDataHandler(const DOMUserDataHandler &);
|
||||
DOMUserDataHandler & operator = (const DOMUserDataHandler &);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMUserDataHandler() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Class Types
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Public Constants */
|
||||
//@{
|
||||
/**
|
||||
* Operation Type
|
||||
*
|
||||
* <p><code>NODE_CLONED:</code>
|
||||
* The node is cloned.</p>
|
||||
*
|
||||
* <p><code>NODE_IMPORTED</code>
|
||||
* The node is imported.</p>
|
||||
*
|
||||
* <p><code>NODE_DELETED</code>
|
||||
* The node is deleted.</p>
|
||||
*
|
||||
* <p><code>NODE_RENAMED</code>
|
||||
* The node is renamed.
|
||||
*
|
||||
* <p><code>NODE_ADOPTED</code>
|
||||
* The node is adopted.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
enum DOMOperationType {
|
||||
NODE_CLONED = 1,
|
||||
NODE_IMPORTED = 2,
|
||||
NODE_DELETED = 3,
|
||||
NODE_RENAMED = 4,
|
||||
NODE_ADOPTED = 5
|
||||
};
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMUserDataHandler interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
/**
|
||||
* This method is called whenever the node for which this handler is
|
||||
* registered is imported or cloned.
|
||||
*
|
||||
* @param operation Specifies the type of operation that is being
|
||||
* performed on the node.
|
||||
* @param key Specifies the key for which this handler is being called.
|
||||
* @param data Specifies the data for which this handler is being called.
|
||||
* @param src Specifies the node being cloned, adopted, imported, or renamed.
|
||||
* This is <code>null</code> when the node is being deleted.
|
||||
* @param dst Specifies the node newly created if any, or <code>null</code>.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual void handle(DOMOperationType operation,
|
||||
const XMLCh* const key,
|
||||
void* data,
|
||||
const DOMNode* src,
|
||||
DOMNode* dst) = 0;
|
||||
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMXPathEvaluator.hpp 698579 2008-09-24 14:13:08Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHEVALUATOR_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMXPATHEVALUATOR_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMXPathResult.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMXPathNSResolver;
|
||||
class DOMXPathExpression;
|
||||
class DOMNode;
|
||||
|
||||
/**
|
||||
* The evaluation of XPath expressions is provided by <code>DOMXPathEvaluator</code>.
|
||||
* In a DOM implementation which supports the XPath feature, the <code>DOMXPathEvaluator</code>
|
||||
* interface will be implemented on the same object which implements the Document interface permitting
|
||||
* it to be obtained by casting or by using the DOM Level 3 getFeature method. In this case the
|
||||
* implementation obtained from the Document supports the XPath DOM module and is compatible
|
||||
* with the XPath 1.0 specification.
|
||||
* Evaluation of expressions with specialized extension functions or variables may not
|
||||
* work in all implementations and is, therefore, not portable. XPathEvaluator implementations
|
||||
* may be available from other sources that could provide specific support for specialized extension
|
||||
* functions or variables as would be defined by other specifications.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
class CDOM_EXPORT DOMXPathEvaluator
|
||||
{
|
||||
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMXPathEvaluator() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMXPathEvaluator(const DOMXPathEvaluator &);
|
||||
DOMXPathEvaluator& operator = (const DOMXPathEvaluator&);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMXPathEvaluator() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMXPathEvaluator interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Creates a parsed XPath expression with resolved namespaces. This is useful
|
||||
* when an expression will be reused in an application since it makes it
|
||||
* possible to compile the expression string into a more efficient internal
|
||||
* form and preresolve all namespace prefixes which occur within the expression.
|
||||
* @param expression of type XMLCh - The XPath expression string to be parsed.
|
||||
* @param resolver of type <code>XPathNSResolver</code> - The resolver permits
|
||||
* translation of all prefixes, including the xml namespace prefix, within the XPath expression
|
||||
* into appropriate namespace URIs. If this is specified as null, any namespace
|
||||
* prefix within the expression will result in <code>DOMException</code> being thrown with the
|
||||
* code NAMESPACE_ERR.
|
||||
* @return <code>DOMXPathExpression</code> The compiled form of the XPath expression.
|
||||
* @exception <code>DOMXPathException</code>
|
||||
* INVALID_EXPRESSION_ERR: Raised if the expression is not legal according to the
|
||||
* rules of the <code>DOMXPathEvaluator</code>.
|
||||
* @exception DOMException
|
||||
* NAMESPACE_ERR: Raised if the expression contains namespace prefixes which cannot
|
||||
* be resolved by the specified <code>XPathNSResolver</code>.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMXPathExpression* createExpression(const XMLCh *expression,
|
||||
const DOMXPathNSResolver *resolver) = 0;
|
||||
|
||||
|
||||
/** Adapts any DOM node to resolve namespaces so that an XPath expression can be
|
||||
* easily evaluated relative to the context of the node where it appeared within
|
||||
* the document. This adapter works like the DOM Level 3 method lookupNamespaceURI
|
||||
* on nodes in resolving the namespaceURI from a given prefix using the current
|
||||
* information available in the node's hierarchy at the time lookupNamespaceURI
|
||||
* is called. also correctly resolving the implicit xml prefix.
|
||||
* @param nodeResolver of type <code>DOMNode</code> The node to be used as a context
|
||||
* for namespace resolution. If this parameter is null, an unpopulated
|
||||
* <code>DOMXPathNSResolver</code> is returned, which can be populated using the
|
||||
* Xerces-C extension <code>DOMXPathNSResolver::addNamespaceBinding()</code>.
|
||||
* @return <code>DOMXPathNSResolver</code> The object which resolves namespaces
|
||||
* with respect to the definitions in scope for the specified node.
|
||||
*/
|
||||
virtual DOMXPathNSResolver* createNSResolver(const DOMNode *nodeResolver) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Evaluates an XPath expression string and returns a result of the specified
|
||||
* type if possible.
|
||||
* @param expression of type XMLCh The XPath expression string to be parsed
|
||||
* and evaluated.
|
||||
* @param contextNode of type <code>DOMNode</code> The context is context node
|
||||
* for the evaluation
|
||||
* of this XPath expression. If the <code>DOMXPathEvaluator</code> was obtained by
|
||||
* casting the <code>DOMDocument</code> then this must be owned by the same
|
||||
* document and must be a <code>DOMDocument</code>, <code>DOMElement</code>,
|
||||
* <code>DOMAttribute</code>, <code>DOMText</code>, <code>DOMCDATASection</code>,
|
||||
* <code>DOMComment</code>, <code>DOMProcessingInstruction</code>, or
|
||||
* <code>XPathNamespace</code> node. If the context node is a <code>DOMText</code> or
|
||||
* a <code>DOMCDATASection</code>, then the context is interpreted as the whole
|
||||
* logical text node as seen by XPath, unless the node is empty in which case it
|
||||
* may not serve as the XPath context.
|
||||
* @param resolver of type <code>XPathNSResolver</code> The resolver permits
|
||||
* translation of all prefixes, including the xml namespace prefix, within
|
||||
* the XPath expression into appropriate namespace URIs. If this is specified
|
||||
* as null, any namespace prefix within the expression will result in
|
||||
* <code>DOMException</code> being thrown with the code NAMESPACE_ERR.
|
||||
* @param type - If a specific type is specified, then
|
||||
* the result will be returned as the corresponding type. This must be one
|
||||
* of the codes of the <code>DOMXPathResult</code> interface.
|
||||
* @param result of type DOMXPathResult* - The result specifies a specific result object
|
||||
* which may be reused and returned by this method. If this is specified as
|
||||
* null or the implementation does not reuse the specified result, a new result
|
||||
* object will be constructed and returned.
|
||||
* @return DOMXPathResult* The result of the evaluation of the XPath expression.
|
||||
* @exception <code>DOMXPathException</code>
|
||||
* INVALID_EXPRESSION_ERR: Raised if the expression is not legal
|
||||
* according to the rules of the <code>DOMXPathEvaluator</code>
|
||||
* TYPE_ERR: Raised if the result cannot be converted to return the specified type.
|
||||
* @exception <code>DOMException</code>
|
||||
* NAMESPACE_ERR: Raised if the expression contains namespace prefixes
|
||||
* which cannot be resolved by the specified <code>XPathNSResolver</code>.
|
||||
* WRONG_DOCUMENT_ERR: The DOMNode is from a document that is not supported
|
||||
* by this <code>DOMXPathEvaluator</code>.
|
||||
* NOT_SUPPORTED_ERR: The DOMNode is not a type permitted as an XPath context
|
||||
* node or the request type is not permitted by this <code>DOMXPathEvaluator</code>.
|
||||
*/
|
||||
virtual DOMXPathResult* evaluate(const XMLCh *expression,
|
||||
const DOMNode *contextNode,
|
||||
const DOMXPathNSResolver *resolver,
|
||||
DOMXPathResult::ResultType type,
|
||||
DOMXPathResult* result) = 0;
|
||||
|
||||
//@}
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "DOMXPathException.hpp"
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
#include <xercesc/util/XMLMsgLoader.hpp>
|
||||
#include <xercesc/util/XMLDOMMsg.hpp>
|
||||
#include "impl/DOMImplementationImpl.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
DOMXPathException::DOMXPathException()
|
||||
: DOMException()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DOMXPathException::DOMXPathException(short exCode,
|
||||
short messageCode,
|
||||
MemoryManager* const memoryManager)
|
||||
: DOMException(exCode, messageCode?messageCode:XMLDOMMsg::DOMXPATHEXCEPTION_ERRX+exCode-DOMXPathException::INVALID_EXPRESSION_ERR+1, memoryManager)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DOMXPathException::DOMXPathException(const DOMXPathException &other)
|
||||
: DOMException(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DOMXPathException::~DOMXPathException()
|
||||
{
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMXPathException.hpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHEXCEPTION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMXPATHEXCEPTION_HPP
|
||||
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
class CDOM_EXPORT DOMXPathException : public DOMException
|
||||
{
|
||||
public:
|
||||
//@{
|
||||
/**
|
||||
* ExceptionCode
|
||||
* <br>INVALID_EXPRESSION_ERR The expression has a syntax error or otherwise
|
||||
* is not a legal expression according to the rules of the specific
|
||||
* <code>DOMXPathEvaluator</code> or contains specialized extension functions
|
||||
* or variables not supported by this implementation.
|
||||
* <br>TYPE_ERR The expression cannot be converted to return the specified type.
|
||||
* <br>NO_RESULT_ERROR There is no current result in the result object.
|
||||
*/
|
||||
enum ExceptionCode {
|
||||
INVALID_EXPRESSION_ERR = 51,
|
||||
TYPE_ERR = 52,
|
||||
NO_RESULT_ERROR = 53
|
||||
};
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
/**
|
||||
* Default constructor for DOMXPathException.
|
||||
*
|
||||
*/
|
||||
DOMXPathException();
|
||||
|
||||
/**
|
||||
* Constructor which takes an error code and a message.
|
||||
*
|
||||
* @param code The error code which indicates the exception
|
||||
* @param messageCode The string containing the error message
|
||||
* @param memoryManager The memory manager used to (de)allocate memory
|
||||
*/
|
||||
DOMXPathException(short code,
|
||||
short messageCode = 0,
|
||||
MemoryManager* const memoryManager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
/**
|
||||
* Copy constructor.
|
||||
*
|
||||
* @param other The object to be copied.
|
||||
*/
|
||||
DOMXPathException(const DOMXPathException &other);
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Destructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor. */
|
||||
//@{
|
||||
/**
|
||||
* Destructor for DOMXPathException.
|
||||
*
|
||||
*/
|
||||
virtual ~DOMXPathException();
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMXPathException& operator = (const DOMXPathException&);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMXPathExpression.hpp 698579 2008-09-24 14:13:08Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHEXPRESSION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMXPATHEXPRESSION_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMXPathResult.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMNode;
|
||||
|
||||
/**
|
||||
* The <code>DOMXPathExpression</code> interface represents a parsed and resolved XPath expression.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
class CDOM_EXPORT DOMXPathExpression
|
||||
{
|
||||
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMXPathExpression() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMXPathExpression(const DOMXPathExpression &);
|
||||
DOMXPathExpression& operator = (const DOMXPathExpression&);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMXPathExpression() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMXPathExpression interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Evaluates this XPath expression and returns a result.
|
||||
* @param contextNode of type <code>DOMNode</code> The context is context
|
||||
* node for the evaluation of this XPath expression.
|
||||
* If the XPathEvaluator was obtained by casting the Document then this must
|
||||
* be owned by the same document and must be a <code>DOMDocument</code>, <code>DOMElement</code>,
|
||||
* <code>DOMAttribute</code>, <code>DOMText</code>, <code>DOMCDATASection</code>,
|
||||
* <code>DOMComment</code>, <code>DOMProcessingInstruction</code>, or
|
||||
* <code>XPathNamespace</code>. If the context node is a <code>DOMText</code> or a
|
||||
* <code>DOMCDATASection</code>, then the context is interpreted as the whole logical
|
||||
* text node as seen by XPath, unless the node is empty in which case it may not
|
||||
* serve as the XPath context.
|
||||
* @param type If a specific type is specified, then the result
|
||||
* will be coerced to return the specified type relying on XPath conversions and fail
|
||||
* if the desired coercion is not possible. This must be one of the type codes of <code>DOMXPathResult</code>.
|
||||
* @param result of type DOMXPathResult* The result specifies a specific result object which
|
||||
* may be reused and returned by this method. If this is specified as nullor the
|
||||
* implementation does not reuse the specified result, a new result object will be constructed
|
||||
* and returned.
|
||||
* @return DOMXPathResult* The result of the evaluation of the XPath expression.
|
||||
* @exception <code>DOMXPathException</code>
|
||||
* TYPE_ERR: Raised if the result cannot be converted to return the specified type.
|
||||
* @exception <code>DOMException</code>
|
||||
* WRONG_DOCUMENT_ERR: The <code>DOMNode</code> is from a document that is not supported by
|
||||
* the <code>XPathEvaluator</code> that created this <code>DOMXPathExpression</code>.
|
||||
* NOT_SUPPORTED_ERR: The DOMNode is not a type permitted as an XPath context node or the
|
||||
* request type is not permitted by this <code>DOMXPathExpression</code>.
|
||||
*/
|
||||
|
||||
virtual DOMXPathResult* evaluate(const DOMNode *contextNode,
|
||||
DOMXPathResult::ResultType type,
|
||||
DOMXPathResult* result) const = 0;
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard Extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard Extension */
|
||||
//@{
|
||||
/**
|
||||
* Called to indicate that this DOMXPathExpression is no longer in use
|
||||
* and that the implementation may relinquish any resources associated with it.
|
||||
*
|
||||
* Access to a released object will lead to unexpected result.
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMXPathNSResolver.hpp 698579 2008-09-24 14:13:08Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHNSRESOLVER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMXPATHNSRESOLVER_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
/**
|
||||
* The <code>DOMXPathNSResolver</code> interface permit prefix strings
|
||||
* in the expression to be properly bound to namespaceURI strings.
|
||||
* <code>DOMXPathEvaluator</code> can construct an implementation of
|
||||
* <code>DOMXPathNSResolver</code> from a node, or the interface may be
|
||||
* implemented by any application.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
class CDOM_EXPORT DOMXPathNSResolver
|
||||
{
|
||||
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMXPathNSResolver() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMXPathNSResolver(const DOMXPathNSResolver &);
|
||||
DOMXPathNSResolver& operator = (const DOMXPathNSResolver&);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMXPathNSResolver() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMDocument interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
|
||||
/** Look up the namespace URI associated to the given namespace prefix.
|
||||
*
|
||||
* @param prefix of type XMLCh - The prefix to look for. An empty or
|
||||
* null string denotes the default namespace.
|
||||
* @return the associated namespace URI or null if none is found.
|
||||
*/
|
||||
virtual const XMLCh* lookupNamespaceURI(const XMLCh* prefix) const = 0;
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard extension */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Non-standard extension
|
||||
*
|
||||
* XPath2 implementations require a reverse lookup in the static context.
|
||||
* Look up the prefix associated with the namespace URI
|
||||
* @param URI of type XMLCh - The namespace to look for.
|
||||
* @return the associated prefix which can be an empty string if this
|
||||
* is a default namespace or null if none is found.
|
||||
*/
|
||||
virtual const XMLCh* lookupPrefix(const XMLCh* URI) const = 0;
|
||||
|
||||
/**
|
||||
* Non-standard extension
|
||||
*
|
||||
* Associate the given namespace prefix to the namespace URI.
|
||||
* @param prefix of type XMLCh - The namespace prefix to bind. An empty
|
||||
* or null string denotes the default namespace.
|
||||
* @param uri of type XMLCh - The associated namespace URI. If this
|
||||
* argument is null or an empty string then the existing binding for this
|
||||
* prefix is removed.
|
||||
*/
|
||||
virtual void addNamespaceBinding(const XMLCh* prefix, const XMLCh* uri) = 0;
|
||||
|
||||
/**
|
||||
* Called to indicate that this object (and its associated children) is no longer in use
|
||||
* and that the implementation may relinquish any resources associated with it and
|
||||
* its associated children.
|
||||
*
|
||||
* Access to a released object will lead to unexpected result.
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
|
||||
//@}
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMXPathNamespace.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHNAMESPACE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMXPATHNAMESPACE_HPP
|
||||
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMElement;
|
||||
|
||||
/**
|
||||
* The <code>DOMXPathNamespace</code> interface is returned by <code>DOMXPathResult</code>
|
||||
* interfaces to represent the XPath namespace node type that DOM lacks. There is no
|
||||
* public constructor for this node type. Attempts to place it into a hierarchy or a
|
||||
* NamedNodeMap result in a DOMException with the code HIERARCHY_REQUEST_ERR. This node
|
||||
* is read only, so methods or setting of attributes that would mutate the node result
|
||||
* in a <code>DOMException</code> with the code NO_MODIFICATION_ALLOWED_ERR.
|
||||
* The core specification describes attributes of the <code>DOMNode</code> interface that
|
||||
* are different for different node types but does not describe XPATH_NAMESPACE_NODE,
|
||||
* so here is a description of those attributes for this node type. All attributes of
|
||||
* <code>DOMNode</code> not described in this section have a null or false value.
|
||||
* ownerDocument matches the ownerDocument of the ownerElement even if the element is later adopted.
|
||||
* nodeName is always the string "#namespace".
|
||||
* prefix is the prefix of the namespace represented by the node.
|
||||
* localName is the same as prefix.
|
||||
* nodeType is equal to XPATH_NAMESPACE_NODE.
|
||||
* namespaceURI is the namespace URI of the namespace represented by the node.
|
||||
* nodeValue is the same as namespaceURI.
|
||||
* adoptNode, cloneNode, and importNode fail on this node type by raising a DOMException with the code NOT_SUPPORTED_ERR.
|
||||
* Note: In future versions of the XPath specification, the definition of a namespace node may
|
||||
* be changed incompatibly, in which case incompatible changes to field values may be required to
|
||||
* implement versions beyond XPath 1.0.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
class CDOM_EXPORT DOMXPathNamespace : public DOMNode
|
||||
{
|
||||
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMXPathNamespace() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMXPathNamespace(const DOMXPathNamespace &);
|
||||
DOMXPathNamespace& operator = (const DOMXPathNamespace&);
|
||||
//@}
|
||||
|
||||
public:
|
||||
|
||||
|
||||
enum XPathNodeType {
|
||||
XPATH_NAMESPACE_NODE = 13
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMXPathNamespace() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMXPathNamespace interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
/**
|
||||
* The <code>DOMElement</code> on which the namespace was in scope when
|
||||
* it was requested. This does not change on a returned namespace node
|
||||
* even if the document changes such that the namespace goes out of
|
||||
* scope on that element and this node is no longer found there by XPath.
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
virtual DOMElement *getOwnerElement() const = 0;
|
||||
|
||||
//@}
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,351 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMXPathResult.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHRESULT_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMXPATHRESULT_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMXPathNSResolver;
|
||||
class DOMXPathExpression;
|
||||
class DOMTypeInfo;
|
||||
class DOMNode;
|
||||
|
||||
/**
|
||||
* The <code>DOMXPathResult</code> interface represents the result of the
|
||||
* evaluation of an XPath 1.0 or XPath 2.0 expression within the context
|
||||
* of a particular node. Since evaluation of an XPath expression can result
|
||||
* in various result types, this object makes it possible to discover and
|
||||
* manipulate the type and value of the result.
|
||||
*
|
||||
* Note that some function signatures were changed compared to the
|
||||
* DOM Level 3 in order to accommodate XPath 2.0.
|
||||
*
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
class CDOM_EXPORT DOMXPathResult
|
||||
{
|
||||
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Hidden constructors */
|
||||
//@{
|
||||
DOMXPathResult() {};
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Unimplemented constructors and operators */
|
||||
//@{
|
||||
DOMXPathResult(const DOMXPathResult &);
|
||||
DOMXPathResult& operator = (const DOMXPathResult&);
|
||||
//@}
|
||||
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// All constructors are hidden, just the destructor is available
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~DOMXPathResult() {};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Class Types
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Public Constants */
|
||||
//@{
|
||||
/**
|
||||
* <p>ANY_TYPE
|
||||
* <br>[XPath 1.0] This code does not represent a specific type. An evaluation of an XPath
|
||||
* expression will never produce this type. If this type is requested, then
|
||||
* the evaluation returns whatever type naturally results from evaluation
|
||||
* of the expression.
|
||||
* If the natural result is a node set when ANY_TYPE was requested, then
|
||||
* UNORDERED_NODE_ITERATOR_TYPE is always the resulting type. Any other
|
||||
* representation of a node set must be explicitly requested.
|
||||
* <p>ANY_UNORDERED_NODE_TYPE
|
||||
* <br>[XPath 1.0] The result is a node set as defined by XPath 1.0 and will be accessed
|
||||
* as a single node, which may be null if the node set is empty. Document
|
||||
* modification does not invalidate the node, but may mean that the result
|
||||
* node no longer corresponds to the current document. This is a convenience
|
||||
* that permits optimization since the implementation can stop once any node
|
||||
* in the resulting set has been found.
|
||||
* If there is more than one node in the actual result, the single node
|
||||
* returned might not be the first in document order.
|
||||
* <p>BOOLEAN_TYPE
|
||||
* <br>[XPath 1.0] The result is a boolean as defined by XPath 1.0. Document modification
|
||||
* does not invalidate the boolean, but may mean that reevaluation would not
|
||||
* yield the same boolean.
|
||||
* <p>FIRST_ORDERED_NODE_TYPE
|
||||
* <br>[XPath 1.0] The result is a node set as defined by XPath 1.0 and will be accessed
|
||||
* as a single node, which may be null if the node set is empty. Document
|
||||
* modification does not invalidate the node, but may mean that the result
|
||||
* node no longer corresponds to the current document. This is a convenience
|
||||
* that permits optimization since the implementation can stop once the first
|
||||
* node in document order of the resulting set has been found.
|
||||
* If there are more than one node in the actual result, the single node
|
||||
* returned will be the first in document order.
|
||||
* <p>NUMBER_TYPE
|
||||
* <br>[XPath 1.0] The result is a number as defined by XPath 1.0. Document modification does
|
||||
* not invalidate the number, but may mean that reevaluation would not yield the
|
||||
* same number.
|
||||
* <p>ORDERED_NODE_ITERATOR_TYPE
|
||||
* <br>[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed
|
||||
* iteratively, which will produce document-ordered nodes. Document modification
|
||||
* invalidates the iteration.
|
||||
* <p>ORDERED_NODE_SNAPSHOT_TYPE
|
||||
* <br>[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed as a
|
||||
* snapshot list of nodes that will be in original document order. Document
|
||||
* modification does not invalidate the snapshot but may mean that reevaluation would
|
||||
* not yield the same snapshot and nodes in the snapshot may have been altered, moved,
|
||||
* or removed from the document.
|
||||
* <p>STRING_TYPE
|
||||
* <br>[XPath 1.0] The result is a string as defined by XPath 1.0. Document modification does not
|
||||
* invalidate the string, but may mean that the string no longer corresponds to the
|
||||
* current document.
|
||||
* <p>UNORDERED_NODE_ITERATOR_TYPE
|
||||
* <br>[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed iteratively,
|
||||
* which may not produce nodes in a particular order. Document modification invalidates the iteration.
|
||||
* This is the default type returned if the result is a node set and ANY_TYPE is requested.
|
||||
* <p>UNORDERED_NODE_SNAPSHOT_TYPE
|
||||
* <br>[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed as a
|
||||
* snapshot list of nodes that may not be in a particular order. Document modification
|
||||
* does not invalidate the snapshot but may mean that reevaluation would not yield the same
|
||||
* snapshot and nodes in the snapshot may have been altered, moved, or removed from the document.
|
||||
* <p>FIRST_RESULT_TYPE
|
||||
* <br>[XPath 2.0] The result is a sequence as defined by XPath 2.0 and will be accessed
|
||||
* as a single current value or there will be no current value if the sequence
|
||||
* is empty. Document modification does not invalidate the value, but may mean
|
||||
* that the result no longer corresponds to the current document. This is a
|
||||
* convenience that permits optimization since the implementation can stop once
|
||||
* the first item in the resulting sequence has been found. If there is more
|
||||
* than one item in the actual result, the single item returned might not be
|
||||
* the first in document order.
|
||||
* <p>ITERATOR_RESULT_TYPE
|
||||
* <br>[XPath 2.0] The result is a sequence as defined by XPath 2.0 that will be accessed
|
||||
* iteratively. Document modification invalidates the iteration.
|
||||
* <p>SNAPSHOT_RESULT_TYPE
|
||||
* <br>[XPath 2.0] The result is a sequence as defined by XPath 2.0 that will be accessed
|
||||
* as a snapshot list of values. Document modification does not invalidate the
|
||||
* snapshot but may mean that reevaluation would not yield the same snapshot
|
||||
* and any items in the snapshot may have been altered, moved, or removed from
|
||||
* the document.
|
||||
*/
|
||||
enum ResultType {
|
||||
/* XPath 1.0 */
|
||||
ANY_TYPE = 0,
|
||||
NUMBER_TYPE = 1,
|
||||
STRING_TYPE = 2,
|
||||
BOOLEAN_TYPE = 3,
|
||||
UNORDERED_NODE_ITERATOR_TYPE = 4,
|
||||
ORDERED_NODE_ITERATOR_TYPE = 5,
|
||||
UNORDERED_NODE_SNAPSHOT_TYPE = 6,
|
||||
ORDERED_NODE_SNAPSHOT_TYPE = 7,
|
||||
ANY_UNORDERED_NODE_TYPE = 8,
|
||||
FIRST_ORDERED_NODE_TYPE = 9,
|
||||
/* XPath 2.0 */
|
||||
FIRST_RESULT_TYPE = 100,
|
||||
ITERATOR_RESULT_TYPE = 101,
|
||||
SNAPSHOT_RESULT_TYPE = 102
|
||||
};
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DOMXPathResult interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Functions introduced in DOM Level 3 */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Returns the result type of this result
|
||||
* @return ResultType
|
||||
* A code representing the type of this result, as defined by the type constants.
|
||||
*/
|
||||
virtual ResultType getResultType() const = 0;
|
||||
|
||||
/**
|
||||
* Returns the DOM type info of the current result node or value
|
||||
* (XPath 2 only).
|
||||
* @return typeInfo of type TypeInfo, readonly
|
||||
*/
|
||||
virtual const DOMTypeInfo *getTypeInfo() const = 0;
|
||||
|
||||
/**
|
||||
* Returns true if the result has a current result and the value is a
|
||||
* node (XPath 2 only). This function is necessary to distinguish
|
||||
* between a string value and a node of type string as returned by
|
||||
* the getTypeInfo() function.
|
||||
* @return isNode of type boolean, readonly
|
||||
*/
|
||||
virtual bool isNode() const = 0;
|
||||
|
||||
/**
|
||||
* Returns the boolean value of this result
|
||||
* @return booleanValue of type boolean
|
||||
* The value of this boolean result.
|
||||
* @exception DOMXPathException
|
||||
* TYPE_ERR: raised if ResultType is not BOOLEAN_TYPE (XPath 1.0) or
|
||||
* if current result cannot be properly converted to boolean (XPath 2.0).
|
||||
* <br>
|
||||
* NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0).
|
||||
*/
|
||||
virtual bool getBooleanValue() const = 0;
|
||||
|
||||
/**
|
||||
* Returns the integer value of this result (XPath 2 only).
|
||||
* @return integerValue of type int
|
||||
* The value of this integer result.
|
||||
* @exception DOMXPathException
|
||||
* TYPE_ERR: raised if current result cannot be properly converted to
|
||||
* int (XPath 2.0).
|
||||
* <br>
|
||||
* NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0).
|
||||
*/
|
||||
virtual int getIntegerValue() const = 0;
|
||||
|
||||
/**
|
||||
* Returns the number value of this result
|
||||
* @return numberValue
|
||||
* The value of this number result. If the native double type of the DOM
|
||||
* binding does not directly support the exact IEEE 754 result of the XPath
|
||||
* expression, then it is up to the definition of the binding to specify how
|
||||
* the XPath number is converted to the native binding number.
|
||||
* @exception DOMXPathException
|
||||
* TYPE_ERR: raised if ResultType is not NUMBER_TYPE (XPath 1.0) or
|
||||
* if current result cannot be properly converted to double (XPath 2.0).
|
||||
* <br>
|
||||
* NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0).
|
||||
*/
|
||||
virtual double getNumberValue() const = 0;
|
||||
|
||||
/**
|
||||
* Returns the string value of this result
|
||||
* @return stringValue
|
||||
* The value of this string result.
|
||||
* @exception DOMXPathException
|
||||
* TYPE_ERR: raised if ResultType is not STRING_TYPE (XPath 1.0) or
|
||||
* if current result cannot be properly converted to string (XPath 2.0).
|
||||
* <br>
|
||||
* NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0).
|
||||
*/
|
||||
virtual const XMLCh* getStringValue() const = 0;
|
||||
|
||||
/**
|
||||
* Returns the node value of this result
|
||||
* @return nodeValue
|
||||
* The value of this node result, which may be null.
|
||||
* @exception DOMXPathException
|
||||
* TYPE_ERR: raised if ResultType is not ANY_UNORDERED_NODE_TYPE,
|
||||
* FIRST_ORDERED_NODE_TYPE, UNORDERED_NODE_ITERATOR_TYPE,
|
||||
* ORDERED_NODE_ITERATOR_TYPE, UNORDERED_NODE_SNAPSHOT_TYPE, or
|
||||
* ORDERED_NODE_SNAPSHOT_TYPE (XPath 1.0) or if current result is
|
||||
* not a node (XPath 2.0).
|
||||
* <br>
|
||||
* NO_RESULT_ERROR: raised if there is no current result in the result
|
||||
* object.
|
||||
*/
|
||||
virtual DOMNode* getNodeValue() const = 0;
|
||||
|
||||
/**
|
||||
* Iterates and returns true if the current result is the next item from the
|
||||
* sequence or false if there are no more items.
|
||||
* @return boolean True if the current result is the next item from the sequence
|
||||
* or false if there are no more items.
|
||||
* @exception XPathException
|
||||
* TYPE_ERR: raised if ResultType is not UNORDERED_NODE_ITERATOR_TYPE or
|
||||
* ORDERED_NODE_ITERATOR_TYPE (XPath 1.0) or if ResultType is not
|
||||
* ITERATOR_RESULT_TYPE (XPath 2.0).
|
||||
* @exception DOMException
|
||||
* INVALID_STATE_ERR: The document has been mutated since the result was returned.
|
||||
*/
|
||||
virtual bool iterateNext() = 0;
|
||||
|
||||
/**
|
||||
* Signifies that the iterator has become invalid.
|
||||
* @return invalidIteratorState
|
||||
* True if ResultType is UNORDERED_NODE_ITERATOR_TYPE or
|
||||
* ORDERED_NODE_ITERATOR_TYPE (XPath 1.0) or ITERATOR_RESULT_TYPE (XPath 2.0)
|
||||
* and the document has been modified since this result was returned.
|
||||
* @exception XPathException
|
||||
* TYPE_ERR: raised if ResultType is not UNORDERED_NODE_ITERATOR_TYPE or
|
||||
* ORDERED_NODE_ITERATOR_TYPE (XPath 1.0) or if ResultType is not
|
||||
* ITERATOR_RESULT_TYPE (XPath 2.0).
|
||||
*/
|
||||
virtual bool getInvalidIteratorState() const = 0;
|
||||
|
||||
/**
|
||||
* Sets the current result to the indexth item in the snapshot collection. If
|
||||
* index is greater than or equal to the number of items in the list, this method
|
||||
* returns false. Unlike the iterator result, the snapshot does not become
|
||||
* invalid, but may not correspond to the current document if it is mutated.
|
||||
* @param index of type XMLSize_t - Index into the snapshot collection.
|
||||
* @return boolean True if the current result is the next item from the sequence
|
||||
* or false if there are no more items.
|
||||
* @exception XPathException
|
||||
* TYPE_ERR: raised if ResultType is not UNORDERED_NODE_SNAPSHOT_TYPE or
|
||||
* ORDERED_NODE_SNAPSHOT_TYPE (XPath 1.0) or if ResultType is not
|
||||
* SNAPSHOT_RESULT_TYPE (XPath 2.0).
|
||||
*/
|
||||
virtual bool snapshotItem(XMLSize_t index) = 0;
|
||||
|
||||
/**
|
||||
* The number of items in the result snapshot. Valid values for snapshotItem
|
||||
* indices are 0 to snapshotLength-1 inclusive.
|
||||
* @return snapshotLength of type XMLSize_t
|
||||
* @exception XPathException
|
||||
* TYPE_ERR: raised if ResultType is not UNORDERED_NODE_SNAPSHOT_TYPE or
|
||||
* ORDERED_NODE_SNAPSHOT_TYPE (XPath 1.0) or if ResultType is not
|
||||
* SNAPSHOT_RESULT_TYPE (XPath 2.0).
|
||||
*/
|
||||
virtual XMLSize_t getSnapshotLength() const = 0;
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Non-standard Extension
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Non-standard Extension */
|
||||
//@{
|
||||
/**
|
||||
* Called to indicate that this DOMXPathResult is no longer in use
|
||||
* and that the implementation may relinquish any resources associated with it.
|
||||
*
|
||||
* Access to a released object will lead to unexpected result.
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
//@}
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: StDOMNode.hpp 570480 2007-08-28 16:36:34Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_STDOMNODE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_STDOMNODE_HPP
|
||||
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
#include <xercesc/dom/DOMAttr.hpp>
|
||||
#include <xercesc/dom/DOMElement.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/* This class is a smart pointer implementation over DOMNode interface and
|
||||
** classes derived from it. It takes care of reference counting automatically.
|
||||
** Reference counting is optional so use of this class is experimental.
|
||||
*/
|
||||
template <class T> class StDOMNode {
|
||||
T* m_node;
|
||||
|
||||
static inline void INCREFCOUNT(T *x) { if (x != (T*)0) x->incRefCount(); }
|
||||
static inline void DECREFCOUNT(T *x) { if (x != (T*)0) x->decRefCount(); }
|
||||
|
||||
public:
|
||||
inline StDOMNode(T* node = (T*)0) : m_node(node) { INCREFCOUNT(m_node); }
|
||||
inline StDOMNode(const StDOMNode& stNode) : m_node(stNode.m_node) { INCREFCOUNT(m_node); }
|
||||
inline ~StDOMNode() { DECREFCOUNT(m_node); }
|
||||
|
||||
inline T* operator= (T *node)
|
||||
{
|
||||
if (m_node != node) {
|
||||
DECREFCOUNT(m_node);
|
||||
m_node = node;
|
||||
INCREFCOUNT(m_node);
|
||||
}
|
||||
return (m_node);
|
||||
}
|
||||
|
||||
inline bool operator!= (T* node) const { return (m_node != node); }
|
||||
inline bool operator== (T* node) const { return (m_node == node); }
|
||||
|
||||
inline T& operator* () { return (*m_node); }
|
||||
inline const T& operator* () const { return (*m_node); }
|
||||
inline T* operator-> () const { return (m_node); }
|
||||
inline operator T*() const { return (m_node); }
|
||||
inline void ClearNode() { operator=((T*)(0)); }
|
||||
};
|
||||
|
||||
#if defined(XML_DOMREFCOUNT_EXPERIMENTAL)
|
||||
typedef StDOMNode<DOMNode> DOMNodeSPtr;
|
||||
#else
|
||||
typedef DOMNode* DOMNodeSPtr;
|
||||
#endif
|
||||
|
||||
/* StDOMNode is a smart pointer implementation over DOMNode interface and
|
||||
** classes derived from it. It takes care of reference counting automatically.
|
||||
** Reference counting is optional so use of this class is experimental.
|
||||
*/
|
||||
#if defined(XML_DOMREFCOUNT_EXPERIMENTAL)
|
||||
typedef StDOMNode<DOMAttr> DOMAttrSPtr;
|
||||
#else
|
||||
typedef DOMAttr* DOMAttrSPtr;
|
||||
#endif
|
||||
|
||||
/* StDOMNode is a smart pointer implementation over DOMNode interface and
|
||||
** classes derived from it. It takes care of reference counting automatically.
|
||||
** Reference counting is optional so use of this class is experimental.
|
||||
*/
|
||||
#if defined(XML_DOMREFCOUNT_EXPERIMENTAL)
|
||||
typedef StDOMNode<DOMElement> DOMElementSPtr;
|
||||
#else
|
||||
typedef DOMElement* DOMElementSPtr;
|
||||
#endif
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,362 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMAttrImpl.cpp 678709 2008-07-22 10:56:56Z borisk $
|
||||
*/
|
||||
|
||||
#include <xercesc/dom/DOMDocument.hpp>
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
|
||||
#include "DOMAttrImpl.hpp"
|
||||
#include "DOMStringPool.hpp"
|
||||
#include "DOMDocumentImpl.hpp"
|
||||
#include "DOMCasts.hpp"
|
||||
#include "DOMTypeInfoImpl.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
DOMAttrImpl::DOMAttrImpl(DOMDocument *ownerDoc, const XMLCh *aName)
|
||||
: fNode(ownerDoc), fParent (ownerDoc), fSchemaType(0)
|
||||
{
|
||||
DOMDocumentImpl *docImpl = (DOMDocumentImpl *)ownerDoc;
|
||||
fName = docImpl->getPooledString(aName);
|
||||
fNode.isSpecified(true);
|
||||
}
|
||||
|
||||
DOMAttrImpl::DOMAttrImpl(const DOMAttrImpl &other, bool /*deep*/)
|
||||
: DOMAttr(other)
|
||||
, fNode(other.fNode)
|
||||
, fParent (other.fParent)
|
||||
, fName(other.fName)
|
||||
, fSchemaType(other.fSchemaType)
|
||||
{
|
||||
if (other.fNode.isSpecified())
|
||||
fNode.isSpecified(true);
|
||||
else
|
||||
fNode.isSpecified(false);
|
||||
|
||||
if (other.fNode.isIdAttr())
|
||||
{
|
||||
fNode.isIdAttr(true);
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument;
|
||||
doc->getNodeIDMap()->add(this);
|
||||
}
|
||||
|
||||
fParent.cloneChildren(&other);
|
||||
}
|
||||
|
||||
|
||||
DOMAttrImpl::~DOMAttrImpl() {
|
||||
}
|
||||
|
||||
|
||||
DOMNode * DOMAttrImpl::cloneNode(bool deep) const
|
||||
{
|
||||
DOMNode* newNode = new (fParent.fOwnerDocument, DOMDocumentImpl::ATTR_OBJECT) DOMAttrImpl(*this, deep);
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
|
||||
return newNode;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMAttrImpl::getNodeName() const{
|
||||
return fName;
|
||||
}
|
||||
|
||||
DOMNode::NodeType DOMAttrImpl::getNodeType() const {
|
||||
return DOMNode::ATTRIBUTE_NODE;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMAttrImpl::getName() const {
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMAttrImpl::getNodeValue() const
|
||||
{
|
||||
return getValue();
|
||||
}
|
||||
|
||||
|
||||
bool DOMAttrImpl::getSpecified() const
|
||||
{
|
||||
return fNode.isSpecified();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const XMLCh * DOMAttrImpl::getValue() const
|
||||
{
|
||||
if (fParent.fFirstChild == 0) {
|
||||
return XMLUni::fgZeroLenString; // return "";
|
||||
}
|
||||
|
||||
// Simple case where attribute value is just a single text node
|
||||
DOMNode *node = castToChildImpl(fParent.fFirstChild)->nextSibling;
|
||||
if (node == 0 && fParent.fFirstChild->getNodeType() == DOMNode::TEXT_NODE) {
|
||||
return fParent.fFirstChild->getNodeValue();
|
||||
}
|
||||
|
||||
//
|
||||
// Complicated case where attribute value is a DOM tree
|
||||
//
|
||||
// According to the spec, the child nodes of the Attr node may be either
|
||||
// Text or EntityReference nodes.
|
||||
//
|
||||
// The parser will not create such thing, this is for those created by users.
|
||||
//
|
||||
// In such case, we have to visit each child to retrieve the text
|
||||
//
|
||||
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*)fParent.fOwnerDocument;
|
||||
|
||||
XMLBuffer buf(1023, doc->getMemoryManager());
|
||||
for (node = fParent.fFirstChild; node != 0; node = castToChildImpl(node)->nextSibling)
|
||||
getTextValue(node, buf);
|
||||
|
||||
return doc->getPooledString(buf.getRawBuffer());
|
||||
}
|
||||
|
||||
void DOMAttrImpl::getTextValue(DOMNode* node, XMLBuffer& buf) const
|
||||
{
|
||||
if (node->getNodeType() == DOMNode::TEXT_NODE)
|
||||
buf.append(node->getNodeValue());
|
||||
else if (node->getNodeType() == DOMNode::ENTITY_REFERENCE_NODE)
|
||||
{
|
||||
for (node = node->getFirstChild(); node != 0; node = castToChildImpl(node)->nextSibling)
|
||||
{
|
||||
getTextValue(node, buf);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void DOMAttrImpl::setNodeValue(const XMLCh *val)
|
||||
{
|
||||
setValue(val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DOMAttrImpl::setSpecified(bool arg)
|
||||
{
|
||||
fNode.isSpecified(arg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DOMAttrImpl::setValue(const XMLCh *val)
|
||||
{
|
||||
if (fNode.isReadOnly())
|
||||
{
|
||||
throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
|
||||
// If this attribute was of type ID and in the map, take it out,
|
||||
// then put it back in with the new name. For now, we don't worry
|
||||
// about what happens if the new name conflicts
|
||||
//
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument;
|
||||
if (fNode.isIdAttr())
|
||||
doc->getNodeIDMap()->remove(this);
|
||||
|
||||
DOMNode *kid;
|
||||
while ((kid = fParent.fFirstChild) != 0) // Remove existing kids
|
||||
{
|
||||
DOMNode* node = removeChild(kid);
|
||||
if (node)
|
||||
node->release();
|
||||
}
|
||||
|
||||
if (val != 0) // Create and add the new one
|
||||
fParent.appendChildFast(doc->createTextNode(val));
|
||||
fNode.isSpecified(true);
|
||||
fParent.changed();
|
||||
|
||||
if (fNode.isIdAttr())
|
||||
doc->getNodeIDMap()->add(this);
|
||||
|
||||
}
|
||||
|
||||
void DOMAttrImpl::setValueFast(const XMLCh *val)
|
||||
{
|
||||
if (val != 0)
|
||||
fParent.appendChildFast(fParent.fOwnerDocument->createTextNode(val));
|
||||
|
||||
fNode.isSpecified (true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Introduced in DOM Level 2
|
||||
|
||||
DOMElement *DOMAttrImpl::getOwnerElement() const
|
||||
{
|
||||
// if we have an owner, ownerNode is our ownerElement, otherwise it's
|
||||
// our ownerDocument and we don't have an ownerElement
|
||||
return (DOMElement *) (fNode.isOwned() ? fNode.fOwnerNode : 0);
|
||||
}
|
||||
|
||||
|
||||
//internal use by parser only
|
||||
void DOMAttrImpl::setOwnerElement(DOMElement *ownerElem)
|
||||
{
|
||||
fNode.fOwnerNode = ownerElem;
|
||||
// revisit. Is this backwards? isOwned(true)?
|
||||
fNode.isOwned(false);
|
||||
}
|
||||
|
||||
|
||||
//For DOM Level 3
|
||||
|
||||
void DOMAttrImpl::release()
|
||||
{
|
||||
if (fNode.isOwned() && !fNode.isToBeReleased())
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*)fParent.fOwnerDocument;
|
||||
if (doc) {
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
|
||||
fParent.release();
|
||||
doc->release(this, DOMMemoryManager::ATTR_OBJECT);
|
||||
}
|
||||
else {
|
||||
// shouldn't reach here
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool DOMAttrImpl::isId() const {
|
||||
return fNode.isIdAttr();
|
||||
}
|
||||
|
||||
|
||||
DOMNode* DOMAttrImpl::rename(const XMLCh* namespaceURI, const XMLCh* name)
|
||||
{
|
||||
DOMElement* el = getOwnerElement();
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*)fParent.fOwnerDocument;
|
||||
|
||||
if (el)
|
||||
el->removeAttributeNode(this);
|
||||
|
||||
if (!namespaceURI || !*namespaceURI) {
|
||||
fName = doc->getPooledString(name);
|
||||
|
||||
if (el)
|
||||
el->setAttributeNode(this);
|
||||
|
||||
// and fire user data NODE_RENAMED event
|
||||
castToNodeImpl(this)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, this);
|
||||
|
||||
return this;
|
||||
}
|
||||
else {
|
||||
|
||||
// create a new AttrNS
|
||||
DOMAttr* newAttr = doc->createAttributeNS(namespaceURI, name);
|
||||
|
||||
// transfer the userData
|
||||
doc->transferUserData(castToNodeImpl(this), castToNodeImpl(newAttr));
|
||||
|
||||
// move children to new node
|
||||
DOMNode* child = getFirstChild();
|
||||
while (child) {
|
||||
removeChild(child);
|
||||
newAttr->appendChild(child);
|
||||
child = getFirstChild();
|
||||
}
|
||||
|
||||
// reattach attr to element
|
||||
if (el)
|
||||
el->setAttributeNodeNS(newAttr);
|
||||
|
||||
// and fire user data NODE_RENAMED event
|
||||
castToNodeImpl(newAttr)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, newAttr);
|
||||
|
||||
return newAttr;
|
||||
}
|
||||
}
|
||||
|
||||
const DOMTypeInfo *DOMAttrImpl::getSchemaTypeInfo() const
|
||||
{
|
||||
if(!fSchemaType)
|
||||
return &DOMTypeInfoImpl::g_DtdNotValidatedAttribute;
|
||||
|
||||
return fSchemaType;
|
||||
}
|
||||
|
||||
|
||||
void DOMAttrImpl::setSchemaTypeInfo(const DOMTypeInfoImpl* typeInfo)
|
||||
{
|
||||
fSchemaType = typeInfo;
|
||||
}
|
||||
|
||||
bool DOMAttrImpl::isSupported(const XMLCh *feature, const XMLCh *version) const
|
||||
{
|
||||
// check for '+DOMPSVITypeInfo'
|
||||
if(feature && *feature=='+' && XMLString::equals(feature+1, XMLUni::fgXercescInterfacePSVITypeInfo))
|
||||
return true;
|
||||
return fNode.isSupported (feature, version);
|
||||
}
|
||||
|
||||
void* DOMAttrImpl::getFeature(const XMLCh* feature, const XMLCh* version) const
|
||||
{
|
||||
if(XMLString::equals(feature, XMLUni::fgXercescInterfacePSVITypeInfo))
|
||||
return (DOMPSVITypeInfo*)fSchemaType;
|
||||
return fNode.getFeature(feature, version);
|
||||
}
|
||||
|
||||
DOMNode* DOMAttrImpl::appendChild(DOMNode *newChild) {return fParent.appendChild (newChild); }
|
||||
DOMNamedNodeMap* DOMAttrImpl::getAttributes() const {return fNode.getAttributes (); }
|
||||
DOMNodeList* DOMAttrImpl::getChildNodes() const {return fParent.getChildNodes (); }
|
||||
DOMNode* DOMAttrImpl::getFirstChild() const {return fParent.getFirstChild (); }
|
||||
DOMNode* DOMAttrImpl::getLastChild() const {return fParent.getLastChild (); }
|
||||
const XMLCh* DOMAttrImpl::getLocalName() const {return fNode.getLocalName (); }
|
||||
const XMLCh* DOMAttrImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); }
|
||||
DOMNode* DOMAttrImpl::getNextSibling() const {return fNode.getNextSibling (); }
|
||||
DOMDocument* DOMAttrImpl::getOwnerDocument() const {return fParent.fOwnerDocument; }
|
||||
const XMLCh* DOMAttrImpl::getPrefix() const {return fNode.getPrefix (); }
|
||||
DOMNode* DOMAttrImpl::getParentNode() const {return fNode.getParentNode (); }
|
||||
DOMNode* DOMAttrImpl::getPreviousSibling() const {return fNode.getPreviousSibling (); }
|
||||
bool DOMAttrImpl::hasChildNodes() const {return fParent.hasChildNodes (); }
|
||||
DOMNode* DOMAttrImpl::insertBefore(DOMNode *newChild, DOMNode *refChild)
|
||||
{return fParent.insertBefore (newChild, refChild); }
|
||||
void DOMAttrImpl::normalize() {fParent.normalize (); }
|
||||
DOMNode* DOMAttrImpl::removeChild(DOMNode *oldChild) {return fParent.removeChild (oldChild); }
|
||||
DOMNode* DOMAttrImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild)
|
||||
{return fParent.replaceChild (newChild, oldChild); }
|
||||
void DOMAttrImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); }
|
||||
bool DOMAttrImpl::hasAttributes() const {return fNode.hasAttributes(); }
|
||||
bool DOMAttrImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); }
|
||||
bool DOMAttrImpl::isEqualNode(const DOMNode* arg) const {return fParent.isEqualNode(arg); }
|
||||
void* DOMAttrImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler)
|
||||
{return fNode.setUserData(key, data, handler); }
|
||||
void* DOMAttrImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); }
|
||||
const XMLCh* DOMAttrImpl::getBaseURI() const {return fNode.getBaseURI(); }
|
||||
short DOMAttrImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); }
|
||||
const XMLCh* DOMAttrImpl::getTextContent() const {return fNode.getTextContent(); }
|
||||
void DOMAttrImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); }
|
||||
const XMLCh* DOMAttrImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); }
|
||||
bool DOMAttrImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); }
|
||||
const XMLCh* DOMAttrImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); }
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMAttrImpl.hpp 678709 2008-07-22 10:56:56Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMATTRIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMATTRIMPL_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include "DOMParentNode.hpp"
|
||||
#include "DOMNodeImpl.hpp"
|
||||
#include "DOMDocumentImpl.hpp"
|
||||
#include <xercesc/dom/DOMAttr.hpp>
|
||||
#include <xercesc/framework/XMLBuffer.hpp>
|
||||
#include "DOMNodeIDMap.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMElementImpl;
|
||||
class DOMTypeInfoImpl;
|
||||
|
||||
class CDOM_EXPORT DOMAttrImpl: public DOMAttr {
|
||||
|
||||
public:
|
||||
DOMNodeImpl fNode;
|
||||
DOMParentNode fParent;
|
||||
const XMLCh *fName;
|
||||
|
||||
protected:
|
||||
const DOMTypeInfoImpl *fSchemaType;
|
||||
|
||||
public:
|
||||
DOMAttrImpl(DOMDocument *ownerDocument, const XMLCh *aName);
|
||||
DOMAttrImpl(const DOMAttrImpl &other, bool deep=false);
|
||||
virtual ~DOMAttrImpl();
|
||||
|
||||
public:
|
||||
// Add all functions that are pure virtual in DOMNODE
|
||||
DOMNODE_FUNCTIONS;
|
||||
|
||||
public:
|
||||
virtual const XMLCh * getName() const;
|
||||
virtual bool getSpecified() const;
|
||||
virtual const XMLCh * getValue() const;
|
||||
virtual void setSpecified(bool arg);
|
||||
virtual void setValue(const XMLCh * value);
|
||||
virtual DOMElement * getOwnerElement() const;
|
||||
virtual bool isId() const;
|
||||
virtual const DOMTypeInfo* getSchemaTypeInfo() const;
|
||||
|
||||
void setOwnerElement(DOMElement *ownerElem); //internal use only
|
||||
|
||||
// helper function for DOM Level 3 renameNode
|
||||
virtual DOMNode* rename(const XMLCh* namespaceURI, const XMLCh* name);
|
||||
|
||||
//helper function for DOM Level 3 TypeInfo
|
||||
virtual void setSchemaTypeInfo(const DOMTypeInfoImpl* typeInfo);
|
||||
|
||||
// helper method that sets this attr to an idnode and places it into the document map
|
||||
virtual void addAttrToIDNodeMap();
|
||||
|
||||
// helper to remove this attr from from the id map if it is in there
|
||||
virtual void removeAttrFromIDNodeMap();
|
||||
|
||||
public:
|
||||
// Set attribute value fast. Assumptions:
|
||||
//
|
||||
// - node is not read-only
|
||||
// - no ID management is performed
|
||||
// - this attribute does not have a value
|
||||
//
|
||||
virtual void setValueFast (const XMLCh * value);
|
||||
|
||||
protected:
|
||||
void getTextValue(DOMNode* node, XMLBuffer& buf) const;
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMAttrImpl& operator=(const DOMAttrImpl&);
|
||||
};
|
||||
|
||||
inline void DOMAttrImpl::removeAttrFromIDNodeMap()
|
||||
{
|
||||
if (fNode.isIdAttr()) {
|
||||
((DOMDocumentImpl *)fParent.fOwnerDocument)->getNodeIDMap()->remove(this);
|
||||
fNode.isIdAttr(false);
|
||||
}
|
||||
}
|
||||
|
||||
inline void DOMAttrImpl::addAttrToIDNodeMap()
|
||||
{
|
||||
if (fNode.isIdAttr())
|
||||
return;
|
||||
|
||||
fNode.isIdAttr(true);
|
||||
|
||||
// REVIST For now, we don't worry about what happens if the new
|
||||
// name conflicts as per setValue
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl *)(fParent.fOwnerDocument);
|
||||
|
||||
if (doc->fNodeIDMap == 0)
|
||||
doc->fNodeIDMap = new (doc) DOMNodeIDMap(500, doc);
|
||||
|
||||
doc->getNodeIDMap()->add(this);
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,494 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* $Id: DOMAttrMapImpl.cpp 678709 2008-07-22 10:56:56Z borisk $
|
||||
*/
|
||||
|
||||
#include "DOMCasts.hpp"
|
||||
#include "DOMNodeImpl.hpp"
|
||||
#include "DOMNodeVector.hpp"
|
||||
#include "DOMAttrMapImpl.hpp"
|
||||
#include "DOMAttrImpl.hpp"
|
||||
#include "DOMElementImpl.hpp"
|
||||
|
||||
#include <xercesc/dom/DOMAttr.hpp>
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
DOMAttrMapImpl::DOMAttrMapImpl(DOMNode *ownerNod)
|
||||
{
|
||||
this->fOwnerNode=ownerNod;
|
||||
this->fNodes = 0;
|
||||
hasDefaults(false);
|
||||
}
|
||||
|
||||
DOMAttrMapImpl::DOMAttrMapImpl(DOMNode *ownerNod, const DOMAttrMapImpl *defaults)
|
||||
{
|
||||
this->fOwnerNode=ownerNod;
|
||||
this->fNodes = 0;
|
||||
hasDefaults(false);
|
||||
if (defaults != 0)
|
||||
{
|
||||
if (defaults->getLength() > 0)
|
||||
{
|
||||
hasDefaults(true);
|
||||
cloneContent(defaults);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DOMAttrMapImpl::~DOMAttrMapImpl()
|
||||
{
|
||||
}
|
||||
|
||||
void DOMAttrMapImpl::cloneContent(const DOMAttrMapImpl *srcmap)
|
||||
{
|
||||
if ((srcmap != 0) && (srcmap->fNodes != 0))
|
||||
{
|
||||
if (fNodes != 0)
|
||||
fNodes->reset();
|
||||
else
|
||||
{
|
||||
XMLSize_t size = srcmap->fNodes->size();
|
||||
if(size > 0) {
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl*)fOwnerNode->getOwnerDocument();
|
||||
fNodes = new (doc) DOMNodeVector(doc, size);
|
||||
}
|
||||
}
|
||||
|
||||
for (XMLSize_t i = 0; i < srcmap->fNodes->size(); i++)
|
||||
{
|
||||
DOMNode *n = srcmap->fNodes->elementAt(i);
|
||||
DOMNode *clone = n->cloneNode(true);
|
||||
castToNodeImpl(clone)->isSpecified(castToNodeImpl(n)->isSpecified());
|
||||
castToNodeImpl(clone)->fOwnerNode = fOwnerNode;
|
||||
castToNodeImpl(clone)->isOwned(true);
|
||||
fNodes->addElement(clone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DOMAttrMapImpl *DOMAttrMapImpl::cloneAttrMap(DOMNode *ownerNode_p)
|
||||
{
|
||||
DOMAttrMapImpl *newmap = new (castToNodeImpl(ownerNode_p)->getOwnerDocument()) DOMAttrMapImpl(ownerNode_p);
|
||||
newmap->cloneContent(this);
|
||||
// newmap->attrDefaults = this->attrDefaults; // revisit
|
||||
return newmap;
|
||||
}
|
||||
|
||||
void DOMAttrMapImpl::setReadOnly(bool readOnl, bool deep)
|
||||
{
|
||||
// this->fReadOnly=readOnl;
|
||||
if(deep && fNodes!=0)
|
||||
{
|
||||
XMLSize_t sz = fNodes->size();
|
||||
for (XMLSize_t i=0; i<sz; ++i) {
|
||||
castToNodeImpl(fNodes->elementAt(i))->setReadOnly(readOnl, deep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool DOMAttrMapImpl::readOnly() {
|
||||
return castToNodeImpl(fOwnerNode)->isReadOnly();
|
||||
}
|
||||
|
||||
int DOMAttrMapImpl::findNamePoint(const XMLCh *name) const
|
||||
{
|
||||
// Binary search
|
||||
int i=0;
|
||||
if(fNodes!=0)
|
||||
{
|
||||
int first=0,last=(int)fNodes->size()-1;
|
||||
|
||||
while(first<=last)
|
||||
{
|
||||
i=(first+last)/2;
|
||||
int test = XMLString::compareString(name, fNodes->elementAt(i)->getNodeName());
|
||||
if(test==0)
|
||||
return i; // Name found
|
||||
else if(test<0)
|
||||
last=i-1;
|
||||
else
|
||||
first=i+1;
|
||||
}
|
||||
if(first>i) i=first;
|
||||
}
|
||||
/********************
|
||||
// Linear search
|
||||
int i = 0;
|
||||
if (fNodes != 0)
|
||||
for (i = 0; i < fNodes.size(); ++i)
|
||||
{
|
||||
int test = name.compareTo(((NodeImpl *) (fNodes.elementAt(i))).getNodeName());
|
||||
if (test == 0)
|
||||
return i;
|
||||
else
|
||||
if (test < 0)
|
||||
{
|
||||
break; // Found insertpoint
|
||||
}
|
||||
}
|
||||
|
||||
*******************/
|
||||
return -1 - i; // not-found has to be encoded.
|
||||
}
|
||||
|
||||
DOMNode * DOMAttrMapImpl::getNamedItem(const XMLCh *name) const
|
||||
{
|
||||
int i=findNamePoint(name);
|
||||
return (i<0) ? 0 : fNodes->elementAt(i);
|
||||
}
|
||||
|
||||
DOMNode *DOMAttrMapImpl::setNamedItem(DOMNode *arg)
|
||||
{
|
||||
if (arg->getNodeType() != DOMNode::ATTRIBUTE_NODE)
|
||||
throw DOMException(DOMException::HIERARCHY_REQUEST_ERR, 0, GetDOMNamedNodeMapMemoryManager);
|
||||
|
||||
DOMDocument *doc = fOwnerNode->getOwnerDocument();
|
||||
DOMNodeImpl *argImpl = castToNodeImpl(arg);
|
||||
if(argImpl->getOwnerDocument() != doc)
|
||||
throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNamedNodeMapMemoryManager);
|
||||
if (this->readOnly())
|
||||
throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
|
||||
if ((arg->getNodeType() == DOMNode::ATTRIBUTE_NODE) && argImpl->isOwned() && (argImpl->fOwnerNode != fOwnerNode))
|
||||
throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0, GetDOMNamedNodeMapMemoryManager);
|
||||
|
||||
argImpl->fOwnerNode = fOwnerNode;
|
||||
argImpl->isOwned(true);
|
||||
int i=findNamePoint(arg->getNodeName());
|
||||
DOMNode * previous=0;
|
||||
if(i>=0)
|
||||
{
|
||||
previous = fNodes->elementAt(i);
|
||||
fNodes->setElementAt(arg,i);
|
||||
}
|
||||
else
|
||||
{
|
||||
i=-1-i; // Insert point (may be end of list)
|
||||
if(0==fNodes)
|
||||
{
|
||||
fNodes=new ((DOMDocumentImpl*)doc) DOMNodeVector(doc);
|
||||
}
|
||||
fNodes->insertElementAt(arg,i);
|
||||
}
|
||||
if (previous != 0) {
|
||||
castToNodeImpl(previous)->fOwnerNode = doc;
|
||||
castToNodeImpl(previous)->isOwned(false);
|
||||
}
|
||||
|
||||
return previous;
|
||||
}
|
||||
|
||||
//Introduced in DOM Level 2
|
||||
|
||||
int DOMAttrMapImpl::findNamePoint(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const
|
||||
{
|
||||
if (fNodes == 0)
|
||||
return -1;
|
||||
// This is a linear search through the same fNodes Vector.
|
||||
// The Vector is sorted on the DOM Level 1 nodename.
|
||||
// The DOM Level 2 NS keys are namespaceURI and Localname,
|
||||
// so we must linear search thru it.
|
||||
// In addition, to get this to work with fNodes without any namespace
|
||||
// (namespaceURI and localNames are both 0) we then use the nodeName
|
||||
// as a secondary key.
|
||||
const XMLSize_t len = fNodes -> size();
|
||||
for (XMLSize_t i = 0; i < len; ++i) {
|
||||
DOMNode *node = fNodes -> elementAt(i);
|
||||
const XMLCh * nNamespaceURI = node->getNamespaceURI();
|
||||
const XMLCh * nLocalName = node->getLocalName();
|
||||
if (!XMLString::equals(nNamespaceURI, namespaceURI)) //URI not match
|
||||
continue;
|
||||
else {
|
||||
if (XMLString::equals(localName, nLocalName)
|
||||
||
|
||||
(nLocalName == 0 && XMLString::equals(localName, node->getNodeName())))
|
||||
return (int)i;
|
||||
}
|
||||
}
|
||||
return -1; //not found
|
||||
}
|
||||
|
||||
DOMNode *DOMAttrMapImpl::getNamedItemNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const
|
||||
{
|
||||
int i = findNamePoint(namespaceURI, localName);
|
||||
return i < 0 ? 0 : fNodes -> elementAt(i);
|
||||
}
|
||||
|
||||
DOMNode *DOMAttrMapImpl::setNamedItemNS(DOMNode* arg)
|
||||
{
|
||||
if (arg->getNodeType() != DOMNode::ATTRIBUTE_NODE)
|
||||
throw DOMException(DOMException::HIERARCHY_REQUEST_ERR, 0, GetDOMNamedNodeMapMemoryManager);
|
||||
|
||||
DOMDocument *doc = fOwnerNode->getOwnerDocument();
|
||||
DOMNodeImpl *argImpl = castToNodeImpl(arg);
|
||||
if (argImpl->getOwnerDocument() != doc)
|
||||
throw DOMException(DOMException::WRONG_DOCUMENT_ERR,0, GetDOMNamedNodeMapMemoryManager);
|
||||
if (this->readOnly())
|
||||
throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
|
||||
if (argImpl->isOwned())
|
||||
throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0, GetDOMNamedNodeMapMemoryManager);
|
||||
|
||||
argImpl->fOwnerNode = fOwnerNode;
|
||||
argImpl->isOwned(true);
|
||||
int i=findNamePoint(arg->getNamespaceURI(), arg->getLocalName());
|
||||
DOMNode *previous=0;
|
||||
if(i>=0) {
|
||||
previous = fNodes->elementAt(i);
|
||||
fNodes->setElementAt(arg,i);
|
||||
} else {
|
||||
i=findNamePoint(arg->getNodeName()); // Insert point (may be end of list)
|
||||
if (i<0)
|
||||
i = -1 - i;
|
||||
if(0==fNodes)
|
||||
fNodes=new ((DOMDocumentImpl*)doc) DOMNodeVector(doc);
|
||||
fNodes->insertElementAt(arg,i);
|
||||
}
|
||||
if (previous != 0) {
|
||||
castToNodeImpl(previous)->fOwnerNode = doc;
|
||||
castToNodeImpl(previous)->isOwned(false);
|
||||
}
|
||||
|
||||
return previous;
|
||||
}
|
||||
|
||||
DOMNode *DOMAttrMapImpl::removeNamedItem(const XMLCh *name)
|
||||
{
|
||||
if (this->readOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
|
||||
int i=findNamePoint(name);
|
||||
DOMNode *removed = 0;
|
||||
|
||||
if(i<0)
|
||||
throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
|
||||
|
||||
removed = fNodes->elementAt(i);
|
||||
fNodes->removeElementAt(i);
|
||||
castToNodeImpl(removed)->fOwnerNode = fOwnerNode->getOwnerDocument();
|
||||
castToNodeImpl(removed)->isOwned(false);
|
||||
|
||||
// Replace it if it had a default value
|
||||
// (DOM spec level 1 - Element Interface)
|
||||
if (hasDefaults() && (removed != 0))
|
||||
{
|
||||
DOMAttrMapImpl* defAttrs = ((DOMElementImpl*)fOwnerNode)->getDefaultAttributes();
|
||||
DOMAttr* attr = (DOMAttr*)(defAttrs->getNamedItem(name));
|
||||
if (attr != 0)
|
||||
{
|
||||
DOMAttr* newAttr = (DOMAttr*)attr->cloneNode(true);
|
||||
setNamedItem(newAttr);
|
||||
}
|
||||
}
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
DOMNode *DOMAttrMapImpl::removeNamedItemNS(const XMLCh *namespaceURI, const XMLCh *localName)
|
||||
{
|
||||
if (this->readOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
|
||||
int i = findNamePoint(namespaceURI, localName);
|
||||
if (i < 0)
|
||||
throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
|
||||
|
||||
DOMNode * removed = fNodes -> elementAt(i);
|
||||
fNodes -> removeElementAt(i); //remove n from nodes
|
||||
castToNodeImpl(removed)->fOwnerNode = fOwnerNode->getOwnerDocument();
|
||||
castToNodeImpl(removed)->isOwned(false);
|
||||
|
||||
// Replace it if it had a default value
|
||||
// (DOM spec level 2 - Element Interface)
|
||||
|
||||
if (hasDefaults() && (removed != 0))
|
||||
{
|
||||
DOMAttrMapImpl* defAttrs = ((DOMElementImpl*)fOwnerNode)->getDefaultAttributes();
|
||||
DOMAttr* attr = (DOMAttr*)(defAttrs->getNamedItemNS(namespaceURI, localName));
|
||||
if (attr != 0)
|
||||
{
|
||||
DOMAttr* newAttr = (DOMAttr*)attr->cloneNode(true);
|
||||
setNamedItemNS(newAttr);
|
||||
}
|
||||
}
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
// remove the name using index
|
||||
// avoid calling findNamePoint again if the index is already known
|
||||
DOMNode * DOMAttrMapImpl::removeNamedItemAt(XMLSize_t index)
|
||||
{
|
||||
if (this->readOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
|
||||
|
||||
DOMNode *removed = item(index);
|
||||
if(!removed)
|
||||
throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
|
||||
|
||||
fNodes->removeElementAt(index);
|
||||
castToNodeImpl(removed)->fOwnerNode = fOwnerNode->getOwnerDocument();
|
||||
castToNodeImpl(removed)->isOwned(false);
|
||||
|
||||
// Replace it if it had a default value
|
||||
// (DOM spec level 1 - Element Interface)
|
||||
if (hasDefaults() && (removed != 0))
|
||||
{
|
||||
DOMAttrMapImpl* defAttrs = ((DOMElementImpl*)fOwnerNode)->getDefaultAttributes();
|
||||
|
||||
const XMLCh* localName = removed->getLocalName();
|
||||
DOMAttr* attr = 0;
|
||||
if (localName)
|
||||
attr = (DOMAttr*)(defAttrs->getNamedItemNS(removed->getNamespaceURI(), localName));
|
||||
else
|
||||
attr = (DOMAttr*)(defAttrs->getNamedItem(((DOMAttr*)removed)->getName()));
|
||||
|
||||
if (attr != 0)
|
||||
{
|
||||
DOMAttr* newAttr = (DOMAttr*)attr->cloneNode(true);
|
||||
setNamedItem(newAttr);
|
||||
}
|
||||
}
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this AttributeMap in sync with the given "defaults" map.
|
||||
* @param defaults The default attributes map to sync with.
|
||||
*/
|
||||
void DOMAttrMapImpl::reconcileDefaultAttributes(const DOMAttrMapImpl* defaults) {
|
||||
|
||||
// remove any existing default
|
||||
XMLSize_t nsize = getLength();
|
||||
for (XMLSize_t i = nsize; i > 0; i--) {
|
||||
DOMAttr* attr = (DOMAttr*)item(i-1);
|
||||
if (!attr->getSpecified()) {
|
||||
removeNamedItemAt(i-1);
|
||||
}
|
||||
}
|
||||
|
||||
hasDefaults(false);
|
||||
|
||||
// add the new defaults
|
||||
if (defaults) {
|
||||
hasDefaults(true);
|
||||
|
||||
if (nsize == 0) {
|
||||
cloneContent(defaults);
|
||||
}
|
||||
else {
|
||||
XMLSize_t dsize = defaults->getLength();
|
||||
for (XMLSize_t n = 0; n < dsize; n++) {
|
||||
DOMAttr* attr = (DOMAttr*)defaults->item(n);
|
||||
|
||||
DOMAttr* newAttr = (DOMAttr*)attr->cloneNode(true);
|
||||
setNamedItemNS(newAttr);
|
||||
DOMAttrImpl* newAttrImpl = (DOMAttrImpl*) newAttr;
|
||||
newAttrImpl->setSpecified(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // reconcileDefaults()
|
||||
|
||||
|
||||
/**
|
||||
* Move specified attributes from the given map to this one
|
||||
*/
|
||||
void DOMAttrMapImpl::moveSpecifiedAttributes(DOMAttrMapImpl* srcmap) {
|
||||
XMLSize_t nsize = srcmap->getLength();
|
||||
|
||||
for (XMLSize_t i = nsize; i > 0; i--) {
|
||||
DOMAttr* attr = (DOMAttr*)srcmap->item(i-1);
|
||||
if (attr->getSpecified()) {
|
||||
srcmap->removeNamedItemAt(i-1);
|
||||
}
|
||||
|
||||
if (attr->getLocalName())
|
||||
setNamedItemNS(attr);
|
||||
else
|
||||
setNamedItem(attr);
|
||||
}
|
||||
} // moveSpecifiedAttributes(AttributeMap):void
|
||||
|
||||
XMLSize_t DOMAttrMapImpl::getLength() const
|
||||
{
|
||||
return (fNodes != 0) ? fNodes->size() : 0;
|
||||
}
|
||||
|
||||
DOMNode * DOMAttrMapImpl::item(XMLSize_t index) const
|
||||
{
|
||||
return (fNodes != 0 && index < fNodes->size()) ?
|
||||
fNodes->elementAt(index) : 0;
|
||||
}
|
||||
|
||||
void DOMAttrMapImpl::setNamedItemFast(DOMNode *arg)
|
||||
{
|
||||
DOMNodeImpl *argImpl = castToNodeImpl(arg);
|
||||
|
||||
argImpl->fOwnerNode = fOwnerNode;
|
||||
argImpl->isOwned(true);
|
||||
int i = findNamePoint(arg->getNodeName());
|
||||
|
||||
if(i >= 0)
|
||||
fNodes->setElementAt(arg, i);
|
||||
else
|
||||
{
|
||||
i= -1 -i;
|
||||
fNodes->insertElementAt(arg, i);
|
||||
}
|
||||
}
|
||||
|
||||
void DOMAttrMapImpl::setNamedItemNSFast(DOMNode* arg)
|
||||
{
|
||||
DOMNodeImpl *argImpl = castToNodeImpl(arg);
|
||||
|
||||
argImpl->fOwnerNode = fOwnerNode;
|
||||
argImpl->isOwned(true);
|
||||
int i=findNamePoint(arg->getNamespaceURI(), arg->getLocalName());
|
||||
|
||||
if(i >= 0)
|
||||
{
|
||||
fNodes->setElementAt(arg,i);
|
||||
}
|
||||
else
|
||||
{
|
||||
i = findNamePoint(arg->getNodeName());
|
||||
|
||||
if (i < 0)
|
||||
i = -1 - i;
|
||||
|
||||
fNodes->insertElementAt(arg,i);
|
||||
}
|
||||
}
|
||||
|
||||
void DOMAttrMapImpl::reserve (XMLSize_t n)
|
||||
{
|
||||
if (fNodes == 0)
|
||||
{
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*)fOwnerNode->getOwnerDocument();
|
||||
fNodes = new (doc) DOMNodeVector(doc, n);
|
||||
}
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMAttrMapImpl.hpp 678709 2008-07-22 10:56:56Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMATTRMAPIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMATTRMAPIMPL_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMNamedNodeMap.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMNode;
|
||||
class DOMNodeVector;
|
||||
|
||||
class CDOM_EXPORT DOMAttrMapImpl : public DOMNamedNodeMap
|
||||
{
|
||||
protected:
|
||||
DOMNodeVector* fNodes;
|
||||
DOMNode* fOwnerNode; // the node this map belongs to
|
||||
bool attrDefaults;
|
||||
|
||||
virtual void cloneContent(const DOMAttrMapImpl *srcmap);
|
||||
|
||||
bool readOnly(); // revisit. Look at owner node read-only.
|
||||
|
||||
public:
|
||||
DOMAttrMapImpl(DOMNode *ownerNod);
|
||||
|
||||
// revisit. This "copy" constructor is used for cloning an Element with Attributes,
|
||||
// and for setting up default attributes. It's probably not right
|
||||
// for one or the other or both.
|
||||
DOMAttrMapImpl(DOMNode *ownerNod, const DOMAttrMapImpl *defaults);
|
||||
DOMAttrMapImpl();
|
||||
|
||||
virtual ~DOMAttrMapImpl();
|
||||
virtual DOMAttrMapImpl *cloneAttrMap(DOMNode *ownerNode);
|
||||
virtual bool hasDefaults();
|
||||
virtual void hasDefaults(bool value);
|
||||
virtual int findNamePoint(const XMLCh *name) const;
|
||||
virtual int findNamePoint(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const;
|
||||
virtual DOMNode* removeNamedItemAt(XMLSize_t index);
|
||||
virtual void setReadOnly(bool readOnly, bool deep);
|
||||
|
||||
|
||||
virtual XMLSize_t getLength() const;
|
||||
virtual DOMNode* item(XMLSize_t index) const;
|
||||
|
||||
virtual DOMNode* getNamedItem(const XMLCh *name) const;
|
||||
virtual DOMNode* setNamedItem(DOMNode *arg);
|
||||
virtual DOMNode* removeNamedItem(const XMLCh *name);
|
||||
|
||||
virtual DOMNode* getNamedItemNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const;
|
||||
virtual DOMNode* setNamedItemNS(DOMNode *arg);
|
||||
virtual DOMNode* removeNamedItemNS(const XMLCh *namespaceURI, const XMLCh *localName);
|
||||
|
||||
// Fast versions of the above functions which bypass validity checks.
|
||||
// It also assumes that fNode is not 0 (call reserve) and that there
|
||||
// is no previous node with this name. These are used in parsing.
|
||||
//
|
||||
void setNamedItemFast(DOMNode *arg);
|
||||
void setNamedItemNSFast(DOMNode *arg);
|
||||
|
||||
// Tries to reserve space for the specified number of elements.
|
||||
// Currently only works on newly-created instances (fNodes == 0).
|
||||
//
|
||||
void reserve (XMLSize_t);
|
||||
|
||||
void reconcileDefaultAttributes(const DOMAttrMapImpl* defaults);
|
||||
void moveSpecifiedAttributes(DOMAttrMapImpl* srcmap);
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMAttrMapImpl(const DOMAttrMapImpl &);
|
||||
DOMAttrMapImpl & operator = (const DOMAttrMapImpl &);
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// DOMAttrMapImpl: Getters & Setters
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
inline bool DOMAttrMapImpl::hasDefaults()
|
||||
{
|
||||
return attrDefaults;
|
||||
}
|
||||
|
||||
inline void DOMAttrMapImpl::hasDefaults(bool value)
|
||||
{
|
||||
attrDefaults = value;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,247 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMAttrNSImpl.cpp 901107 2010-01-20 08:45:02Z borisk $
|
||||
*/
|
||||
|
||||
#include <xercesc/util/XMLUniDefs.hpp>
|
||||
#include "DOMAttrNSImpl.hpp"
|
||||
#include "DOMDocumentImpl.hpp"
|
||||
#include <xercesc/dom/DOMDocument.hpp>
|
||||
#include <xercesc/dom/DOMElement.hpp>
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
|
||||
#include "assert.h"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
DOMAttrNSImpl::DOMAttrNSImpl(DOMDocument *ownerDoc, const XMLCh *nam) :
|
||||
DOMAttrImpl(ownerDoc, nam)
|
||||
{
|
||||
this->fNamespaceURI=0; //DOM Level 2
|
||||
this->fLocalName=0; //DOM Level 2
|
||||
this->fPrefix=0;
|
||||
}
|
||||
|
||||
//Introduced in DOM Level 2
|
||||
DOMAttrNSImpl::DOMAttrNSImpl(DOMDocument *ownerDoc,
|
||||
const XMLCh *namespaceURI,
|
||||
const XMLCh *qualifiedName) :
|
||||
DOMAttrImpl(ownerDoc, qualifiedName)
|
||||
{
|
||||
setName(namespaceURI, qualifiedName);
|
||||
}
|
||||
|
||||
DOMAttrNSImpl::
|
||||
DOMAttrNSImpl(DOMDocument *ownerDoc,
|
||||
const XMLCh *namespaceURI,
|
||||
const XMLCh *prefix,
|
||||
const XMLCh *localName,
|
||||
const XMLCh *qualifiedName)
|
||||
: DOMAttrImpl(ownerDoc, qualifiedName)
|
||||
{
|
||||
DOMDocumentImpl* docImpl = (DOMDocumentImpl*)fParent.fOwnerDocument;
|
||||
|
||||
if (prefix == 0 || *prefix == 0)
|
||||
{
|
||||
fPrefix = 0;
|
||||
fLocalName = fName;
|
||||
}
|
||||
else
|
||||
{
|
||||
fPrefix = docImpl->getPooledString(prefix);
|
||||
fLocalName = docImpl->getPooledString(localName);
|
||||
}
|
||||
|
||||
// DOM Level 3: namespace URI is never empty string.
|
||||
//
|
||||
const XMLCh * URI = DOMNodeImpl::mapPrefix
|
||||
(
|
||||
fPrefix,
|
||||
(!namespaceURI || !*namespaceURI) ? 0 : namespaceURI,
|
||||
DOMNode::ATTRIBUTE_NODE
|
||||
);
|
||||
this -> fNamespaceURI = (URI == 0) ? 0 : docImpl->getPooledString(URI);
|
||||
}
|
||||
|
||||
DOMAttrNSImpl::DOMAttrNSImpl(const DOMAttrNSImpl &other, bool deep) :
|
||||
DOMAttrImpl(other, deep)
|
||||
{
|
||||
this->fNamespaceURI = other.fNamespaceURI; //DOM Level 2
|
||||
this->fLocalName = other.fLocalName; //DOM Level 2
|
||||
this->fPrefix = other.fPrefix;
|
||||
}
|
||||
|
||||
DOMNode * DOMAttrNSImpl::cloneNode(bool deep) const
|
||||
{
|
||||
DOMNode* newNode = new (fParent.fOwnerDocument, DOMMemoryManager::ATTR_NS_OBJECT) DOMAttrNSImpl(*this, deep);
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
|
||||
return newNode;
|
||||
}
|
||||
|
||||
const XMLCh * DOMAttrNSImpl::getNamespaceURI() const
|
||||
{
|
||||
return fNamespaceURI;
|
||||
}
|
||||
|
||||
const XMLCh * DOMAttrNSImpl::getPrefix() const
|
||||
{
|
||||
return fPrefix;
|
||||
}
|
||||
|
||||
const XMLCh * DOMAttrNSImpl::getLocalName() const
|
||||
{
|
||||
return fLocalName;
|
||||
}
|
||||
|
||||
void DOMAttrNSImpl::setPrefix(const XMLCh *prefix)
|
||||
{
|
||||
const XMLCh * xmlns = DOMNodeImpl::getXmlnsString();
|
||||
|
||||
if (fNode.isReadOnly())
|
||||
throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
if (fNamespaceURI == 0 || fNamespaceURI[0] == chNull || XMLString::equals(fLocalName, xmlns))
|
||||
throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
if (prefix == 0 || prefix[0] == chNull) {
|
||||
fName = fLocalName;
|
||||
fPrefix = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument;
|
||||
|
||||
if (!doc->isXMLName(prefix))
|
||||
throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, GetDOMNodeMemoryManager);
|
||||
|
||||
const XMLCh * xml = DOMNodeImpl::getXmlString();
|
||||
const XMLCh * xmlURI = DOMNodeImpl::getXmlURIString();
|
||||
const XMLCh * xmlnsURI = DOMNodeImpl::getXmlnsURIString();
|
||||
|
||||
if ((XMLString::equals(prefix, xml) &&
|
||||
!XMLString::equals(fNamespaceURI, xmlURI))
|
||||
|| (XMLString::equals(prefix, xmlns) &&
|
||||
!XMLString::equals(fNamespaceURI, xmlnsURI)))
|
||||
throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
if (XMLString::indexOf(prefix, chColon) != -1) {
|
||||
throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
|
||||
this-> fPrefix = doc->getPooledString(prefix);
|
||||
|
||||
XMLSize_t prefixLen = XMLString::stringLen(prefix);
|
||||
XMLSize_t newQualifiedNameLen = prefixLen+1+XMLString::stringLen(fLocalName);
|
||||
XMLCh* newName;
|
||||
XMLCh temp[256];
|
||||
if (newQualifiedNameLen >= 255)
|
||||
newName = (XMLCh*) doc->getMemoryManager()->allocate
|
||||
(
|
||||
newQualifiedNameLen * sizeof(XMLCh)
|
||||
);//new XMLCh[newQualifiedNameLen];
|
||||
else
|
||||
newName = temp;
|
||||
|
||||
// newName = prefix + chColon + fLocalName;
|
||||
XMLString::copyString(newName, prefix);
|
||||
newName[prefixLen] = chColon;
|
||||
XMLString::copyString(&newName[prefixLen+1], fLocalName);
|
||||
|
||||
fName = doc->getPooledString(newName);
|
||||
|
||||
if (newQualifiedNameLen >= 255)
|
||||
doc->getMemoryManager()->deallocate(newName);//delete[] newName;
|
||||
|
||||
}
|
||||
|
||||
void DOMAttrNSImpl::release()
|
||||
{
|
||||
if (fNode.isOwned() && !fNode.isToBeReleased())
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*)fParent.fOwnerDocument;
|
||||
if (doc) {
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
|
||||
fParent.release();
|
||||
doc->release(this, DOMMemoryManager::ATTR_NS_OBJECT);
|
||||
}
|
||||
else {
|
||||
// shouldn't reach here
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DOMNode* DOMAttrNSImpl::rename(const XMLCh* namespaceURI, const XMLCh* name)
|
||||
{
|
||||
DOMElement* el = getOwnerElement();
|
||||
if (el)
|
||||
el->removeAttributeNode(this);
|
||||
|
||||
setName(namespaceURI, name);
|
||||
|
||||
if (el)
|
||||
el->setAttributeNodeNS(this);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
void DOMAttrNSImpl::setName(const XMLCh* namespaceURI, const XMLCh* qualifiedName)
|
||||
{
|
||||
DOMDocumentImpl* ownerDoc = (DOMDocumentImpl *)fParent.fOwnerDocument;
|
||||
const XMLCh * xmlns = DOMNodeImpl::getXmlnsString();
|
||||
const XMLCh * xmlnsURI = DOMNodeImpl::getXmlnsURIString();
|
||||
this->fName = ownerDoc->getPooledString(qualifiedName);
|
||||
|
||||
int index = DOMDocumentImpl::indexofQualifiedName(qualifiedName);
|
||||
if (index < 0)
|
||||
throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
bool xmlnsAlone = false; //true if attribute name is "xmlns"
|
||||
if (index == 0)
|
||||
{ //qualifiedName contains no ':'
|
||||
if (XMLString::equals(this->fName, xmlns)) {
|
||||
if (!XMLString::equals(namespaceURI, xmlnsURI))
|
||||
throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
xmlnsAlone = true;
|
||||
}
|
||||
fPrefix = 0;
|
||||
fLocalName = fName;
|
||||
}
|
||||
else
|
||||
{
|
||||
fPrefix = ownerDoc->getPooledNString(fName, index);
|
||||
fLocalName = ownerDoc->getPooledString(fName+index+1);
|
||||
|
||||
// Before we carry on, we should check if the prefix or localName are valid XMLName
|
||||
if (!ownerDoc->isXMLName(fPrefix) || !ownerDoc->isXMLName(fLocalName))
|
||||
throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
|
||||
// DOM Level 3: namespace URI is never empty string.
|
||||
const XMLCh * URI = xmlnsAlone ? xmlnsURI
|
||||
: DOMNodeImpl::mapPrefix
|
||||
(
|
||||
fPrefix,
|
||||
(!namespaceURI || !*namespaceURI) ? 0 : namespaceURI,
|
||||
DOMNode::ATTRIBUTE_NODE
|
||||
);
|
||||
this -> fNamespaceURI = (URI == 0) ? 0 : ownerDoc->getPooledString(URI);
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMAttrNSImpl.hpp 678709 2008-07-22 10:56:56Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMATTRNSIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMATTRNSIMPL_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
#include "DOMAttrImpl.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class CDOM_EXPORT DOMAttrNSImpl: public DOMAttrImpl {
|
||||
protected:
|
||||
//Introduced in DOM Level 2
|
||||
const XMLCh * fNamespaceURI; //namespace URI of this node
|
||||
const XMLCh * fLocalName; //local part of qualified name
|
||||
const XMLCh * fPrefix; // prefix part of qualified name
|
||||
// revisit - can return local part
|
||||
// by pointing into the qualified (L1) name.
|
||||
|
||||
public:
|
||||
DOMAttrNSImpl(DOMDocument *ownerDoc, const XMLCh *name);
|
||||
DOMAttrNSImpl(DOMDocument *ownerDoc, //DOM Level 2
|
||||
const XMLCh *namespaceURI, const XMLCh *qualifiedName);
|
||||
DOMAttrNSImpl(const DOMAttrNSImpl &other, bool deep=false);
|
||||
|
||||
// Fast construction without any checks for name validity. Used in
|
||||
// parsing. Note that if prefix is not specified and localName is
|
||||
// 'xmlns', this constructor expects proper namespaceURI.
|
||||
//
|
||||
DOMAttrNSImpl(DOMDocument *ownerDoc,
|
||||
const XMLCh *namespaceURI,
|
||||
const XMLCh *prefix, // Null or empty - no prefix.
|
||||
const XMLCh *localName,
|
||||
const XMLCh *qualifiedName);
|
||||
|
||||
virtual DOMNode * cloneNode(bool deep) const;
|
||||
//Introduced in DOM Level 2
|
||||
virtual const XMLCh * getNamespaceURI() const;
|
||||
virtual const XMLCh * getPrefix() const;
|
||||
virtual const XMLCh * getLocalName() const;
|
||||
virtual void setPrefix(const XMLCh *prefix);
|
||||
virtual void release();
|
||||
|
||||
// helper function for DOM Level 3 renameNode
|
||||
virtual DOMNode* rename(const XMLCh* namespaceURI, const XMLCh* name);
|
||||
void setName(const XMLCh* namespaceURI, const XMLCh* name);
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMAttrNSImpl & operator = (const DOMAttrNSImpl &);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,321 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMCDATASectionImpl.cpp 1027995 2010-10-27 15:09:39Z amassari $
|
||||
*/
|
||||
|
||||
#include "DOMCDATASectionImpl.hpp"
|
||||
#include "DOMNodeImpl.hpp"
|
||||
#include "DOMRangeImpl.hpp"
|
||||
#include "DOMDocumentImpl.hpp"
|
||||
#include "DOMCasts.hpp"
|
||||
#include "DOMStringPool.hpp"
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
#include <xercesc/dom/DOMNodeFilter.hpp>
|
||||
#include <xercesc/dom/DOMTreeWalker.hpp>
|
||||
#include <xercesc/util/XMLUniDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
DOMCDATASectionImpl::DOMCDATASectionImpl(DOMDocument *ownerDoc,
|
||||
const XMLCh *dat)
|
||||
: fNode(ownerDoc), fCharacterData(ownerDoc, dat)
|
||||
{
|
||||
fNode.setIsLeafNode(true);
|
||||
}
|
||||
|
||||
DOMCDATASectionImpl::
|
||||
DOMCDATASectionImpl(DOMDocument *ownerDoc, const XMLCh* data, XMLSize_t n)
|
||||
: fNode(ownerDoc), fCharacterData(ownerDoc, data, n)
|
||||
{
|
||||
fNode.setIsLeafNode(true);
|
||||
}
|
||||
|
||||
DOMCDATASectionImpl::DOMCDATASectionImpl(const DOMCDATASectionImpl &other, bool /*deep*/)
|
||||
: DOMCDATASection(other),
|
||||
fNode(*castToNodeImpl(&other)),
|
||||
fChild(*castToChildImpl(&other)),
|
||||
fCharacterData(other.fCharacterData)
|
||||
{
|
||||
// revisit. Something nees to make "deep" work.
|
||||
}
|
||||
|
||||
|
||||
DOMCDATASectionImpl::~DOMCDATASectionImpl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DOMNode *DOMCDATASectionImpl::cloneNode(bool deep) const
|
||||
{
|
||||
DOMNode* newNode = new (this->getOwnerDocument(), DOMMemoryManager::CDATA_SECTION_OBJECT) DOMCDATASectionImpl(*this, deep);
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
|
||||
return newNode;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMCDATASectionImpl::getNodeName() const {
|
||||
static const XMLCh gcdata_section[] = {chPound, chLatin_c, chLatin_d, chLatin_a, chLatin_t, chLatin_a,
|
||||
chDash, chLatin_s, chLatin_e, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, 0};
|
||||
return gcdata_section;
|
||||
}
|
||||
|
||||
|
||||
DOMNode::NodeType DOMCDATASectionImpl::getNodeType() const {
|
||||
return DOMNode::CDATA_SECTION_NODE;
|
||||
}
|
||||
|
||||
|
||||
bool DOMCDATASectionImpl::isIgnorableWhitespace() const
|
||||
{
|
||||
return fNode.ignorableWhitespace();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// splitText. revist - factor into a common function for use
|
||||
// here and in DOMTextImpl
|
||||
//
|
||||
DOMText *DOMCDATASectionImpl::splitText(XMLSize_t offset)
|
||||
{
|
||||
if (fNode.isReadOnly())
|
||||
{
|
||||
throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
XMLSize_t len = fCharacterData.fDataBuf->getLen();
|
||||
if (offset > len)
|
||||
throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl *)getOwnerDocument();
|
||||
DOMText *newText =
|
||||
doc->createCDATASection(this->substringData(offset, len - offset));
|
||||
|
||||
DOMNode *parent = getParentNode();
|
||||
if (parent != 0)
|
||||
parent->insertBefore(newText, getNextSibling());
|
||||
|
||||
fCharacterData.fDataBuf->chop(offset);
|
||||
|
||||
if (doc != 0) {
|
||||
Ranges* ranges = doc->getRanges();
|
||||
if (ranges != 0) {
|
||||
XMLSize_t sz = ranges->size();
|
||||
if (sz != 0) {
|
||||
for (XMLSize_t i =0; i<sz; i++) {
|
||||
ranges->elementAt(i)->updateSplitInfo( this, newText, offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return newText;
|
||||
}
|
||||
|
||||
|
||||
bool DOMCDATASectionImpl::getIsElementContentWhitespace() const
|
||||
{
|
||||
return isIgnorableWhitespace();
|
||||
}
|
||||
|
||||
const XMLCh* DOMCDATASectionImpl::getWholeText() const
|
||||
{
|
||||
DOMDocument *doc = getOwnerDocument();
|
||||
if (!doc) {
|
||||
throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
return 0;
|
||||
}
|
||||
DOMNode* root=doc->getDocumentElement();
|
||||
DOMTreeWalker* pWalker=doc->createTreeWalker(root!=NULL?root:(DOMNode*)this, DOMNodeFilter::SHOW_ALL, NULL, true);
|
||||
pWalker->setCurrentNode((DOMNode*)this);
|
||||
// Logically-adjacent text nodes are Text or CDATASection nodes that can be visited sequentially in document order or in
|
||||
// reversed document order without entering, exiting, or passing over Element, Comment, or ProcessingInstruction nodes.
|
||||
DOMNode* prevNode;
|
||||
while((prevNode=pWalker->previousNode())!=NULL)
|
||||
{
|
||||
if(prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE)
|
||||
break;
|
||||
}
|
||||
XMLBuffer buff(1023, GetDOMNodeMemoryManager);
|
||||
DOMNode* nextNode;
|
||||
while((nextNode=pWalker->nextNode())!=NULL)
|
||||
{
|
||||
if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE)
|
||||
break;
|
||||
if(nextNode->getNodeType()==TEXT_NODE || nextNode->getNodeType()==CDATA_SECTION_NODE)
|
||||
buff.append(nextNode->getNodeValue());
|
||||
}
|
||||
pWalker->release();
|
||||
|
||||
XMLCh* wholeString = (XMLCh*)((DOMDocumentImpl*)doc)->allocate((buff.getLen()+1) * sizeof(XMLCh));
|
||||
XMLString::copyString(wholeString, buff.getRawBuffer());
|
||||
return wholeString;
|
||||
}
|
||||
|
||||
DOMText* DOMCDATASectionImpl::replaceWholeText(const XMLCh* newText)
|
||||
{
|
||||
DOMDocument *doc = getOwnerDocument();
|
||||
DOMTreeWalker* pWalker=doc->createTreeWalker(doc->getDocumentElement(), DOMNodeFilter::SHOW_ALL, NULL, true);
|
||||
pWalker->setCurrentNode((DOMNode*)this);
|
||||
// Logically-adjacent text nodes are Text or CDATASection nodes that can be visited sequentially in document order or in
|
||||
// reversed document order without entering, exiting, or passing over Element, Comment, or ProcessingInstruction nodes.
|
||||
DOMNode* pFirstTextNode=this;
|
||||
DOMNode* prevNode;
|
||||
while((prevNode=pWalker->previousNode())!=NULL)
|
||||
{
|
||||
if(prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE)
|
||||
break;
|
||||
pFirstTextNode=prevNode;
|
||||
}
|
||||
// before doing any change we need to check if we are going to remove an entity reference that doesn't contain just text
|
||||
DOMNode* pCurrentNode=pWalker->getCurrentNode();
|
||||
DOMNode* nextNode;
|
||||
while((nextNode=pWalker->nextNode())!=NULL)
|
||||
{
|
||||
if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE)
|
||||
break;
|
||||
if(nextNode->getNodeType()==ENTITY_REFERENCE_NODE)
|
||||
{
|
||||
DOMTreeWalker* pInnerWalker=doc->createTreeWalker(nextNode, DOMNodeFilter::SHOW_ALL, NULL, true);
|
||||
while(pInnerWalker->nextNode())
|
||||
{
|
||||
short nodeType=pInnerWalker->getCurrentNode()->getNodeType();
|
||||
if(nodeType!=ENTITY_REFERENCE_NODE && nodeType!=TEXT_NODE && nodeType!=CDATA_SECTION_NODE)
|
||||
throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
pInnerWalker->release();
|
||||
}
|
||||
}
|
||||
DOMText* retVal=NULL;
|
||||
// if the first node in the chain is a text node, replace its content, otherwise create a new node
|
||||
if(newText && *newText)
|
||||
{
|
||||
if(!castToNodeImpl(pFirstTextNode)->isReadOnly() && (pFirstTextNode->getNodeType()==TEXT_NODE || pFirstTextNode->getNodeType()==CDATA_SECTION_NODE))
|
||||
{
|
||||
pFirstTextNode->setNodeValue(newText);
|
||||
retVal=(DOMText*)pFirstTextNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(getNodeType()==TEXT_NODE)
|
||||
retVal=doc->createTextNode(newText);
|
||||
else
|
||||
retVal=doc->createCDATASection(newText);
|
||||
pFirstTextNode->getParentNode()->insertBefore(retVal, pFirstTextNode);
|
||||
}
|
||||
}
|
||||
// now delete all the following text nodes
|
||||
pWalker->setCurrentNode(pCurrentNode);
|
||||
while((nextNode=pWalker->nextNode())!=NULL)
|
||||
{
|
||||
if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE)
|
||||
break;
|
||||
if(nextNode!=retVal)
|
||||
{
|
||||
// keep the tree walker valid
|
||||
pWalker->previousNode();
|
||||
nextNode->getParentNode()->removeChild(nextNode);
|
||||
nextNode->release();
|
||||
}
|
||||
}
|
||||
pWalker->release();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
void DOMCDATASectionImpl::release()
|
||||
{
|
||||
if (fNode.isOwned() && !fNode.isToBeReleased())
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
|
||||
|
||||
if (doc) {
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
|
||||
fCharacterData.releaseBuffer();
|
||||
doc->release(this, DOMMemoryManager::CDATA_SECTION_OBJECT);
|
||||
}
|
||||
else {
|
||||
// shouldn't reach here
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Delegation stubs for other DOM_Node inherited functions.
|
||||
//
|
||||
DOMNode* DOMCDATASectionImpl::appendChild(DOMNode *newChild) {return fNode.appendChild (newChild); }
|
||||
DOMNamedNodeMap* DOMCDATASectionImpl::getAttributes() const {return fNode.getAttributes (); }
|
||||
DOMNodeList* DOMCDATASectionImpl::getChildNodes() const {return fNode.getChildNodes (); }
|
||||
DOMNode* DOMCDATASectionImpl::getFirstChild() const {return fNode.getFirstChild (); }
|
||||
DOMNode* DOMCDATASectionImpl::getLastChild() const {return fNode.getLastChild (); }
|
||||
const XMLCh* DOMCDATASectionImpl::getLocalName() const {return fNode.getLocalName (); }
|
||||
const XMLCh* DOMCDATASectionImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); }
|
||||
DOMNode* DOMCDATASectionImpl::getNextSibling() const {return fChild.getNextSibling (); }
|
||||
const XMLCh* DOMCDATASectionImpl::getNodeValue() const {return fCharacterData.getNodeValue (); }
|
||||
DOMDocument* DOMCDATASectionImpl::getOwnerDocument() const {return fNode.getOwnerDocument(); }
|
||||
const XMLCh* DOMCDATASectionImpl::getPrefix() const {return fNode.getPrefix (); }
|
||||
DOMNode* DOMCDATASectionImpl::getParentNode() const {return fChild.getParentNode (this); }
|
||||
DOMNode* DOMCDATASectionImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); }
|
||||
bool DOMCDATASectionImpl::hasChildNodes() const {return fNode.hasChildNodes (); }
|
||||
DOMNode* DOMCDATASectionImpl::insertBefore(DOMNode *newChild, DOMNode *refChild)
|
||||
{return fNode.insertBefore (newChild, refChild); }
|
||||
void DOMCDATASectionImpl::normalize() {fNode.normalize (); }
|
||||
DOMNode* DOMCDATASectionImpl::removeChild(DOMNode *oldChild) {return fNode.removeChild (oldChild); }
|
||||
DOMNode* DOMCDATASectionImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild)
|
||||
{return fNode.replaceChild (newChild, oldChild); }
|
||||
bool DOMCDATASectionImpl::isSupported(const XMLCh *feature, const XMLCh *version) const
|
||||
{return fNode.isSupported (feature, version); }
|
||||
void DOMCDATASectionImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); }
|
||||
bool DOMCDATASectionImpl::hasAttributes() const {return fNode.hasAttributes(); }
|
||||
bool DOMCDATASectionImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); }
|
||||
bool DOMCDATASectionImpl::isEqualNode(const DOMNode* arg) const {return fNode.isEqualNode(arg); }
|
||||
void* DOMCDATASectionImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler)
|
||||
{return fNode.setUserData(key, data, handler); }
|
||||
void* DOMCDATASectionImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); }
|
||||
const XMLCh* DOMCDATASectionImpl::getBaseURI() const {return fNode.getBaseURI(); }
|
||||
short DOMCDATASectionImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); }
|
||||
const XMLCh* DOMCDATASectionImpl::getTextContent() const {return fNode.getTextContent(); }
|
||||
void DOMCDATASectionImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); }
|
||||
const XMLCh* DOMCDATASectionImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); }
|
||||
bool DOMCDATASectionImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); }
|
||||
const XMLCh* DOMCDATASectionImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); }
|
||||
void* DOMCDATASectionImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); }
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Delegation of CharacerData functions.
|
||||
//
|
||||
|
||||
|
||||
const XMLCh* DOMCDATASectionImpl::getData() const {return fCharacterData.getData();}
|
||||
XMLSize_t DOMCDATASectionImpl::getLength() const {return fCharacterData.getLength();}
|
||||
const XMLCh* DOMCDATASectionImpl::substringData(XMLSize_t offset, XMLSize_t count) const
|
||||
{return fCharacterData.substringData(this, offset, count);}
|
||||
void DOMCDATASectionImpl::appendData(const XMLCh *arg) {fCharacterData.appendData(this, arg);}
|
||||
void DOMCDATASectionImpl::insertData(XMLSize_t offset, const XMLCh *arg)
|
||||
{fCharacterData.insertData(this, offset, arg);}
|
||||
void DOMCDATASectionImpl::deleteData(XMLSize_t offset, XMLSize_t count)
|
||||
{fCharacterData.deleteData(this, offset, count);}
|
||||
void DOMCDATASectionImpl::replaceData(XMLSize_t offset, XMLSize_t count, const XMLCh *arg)
|
||||
{fCharacterData.replaceData(this, offset, count, arg);}
|
||||
void DOMCDATASectionImpl::setData(const XMLCh *data) {fCharacterData.setData(this, data);}
|
||||
void DOMCDATASectionImpl::setNodeValue(const XMLCh *nodeValue) {fCharacterData.setNodeValue (this, nodeValue); }
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMCDATASectionImpl.hpp 678709 2008-07-22 10:56:56Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMCDATASECTIONIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMCDATASECTIONIMPL_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMCDATASection.hpp>
|
||||
#include "DOMNodeImpl.hpp"
|
||||
#include "DOMChildNode.hpp"
|
||||
#include "DOMParentNode.hpp"
|
||||
#include "DOMCharacterDataImpl.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class CDOM_EXPORT DOMCDATASectionImpl: public DOMCDATASection {
|
||||
protected:
|
||||
DOMNodeImpl fNode;
|
||||
DOMChildNode fChild;
|
||||
DOMCharacterDataImpl fCharacterData;
|
||||
|
||||
|
||||
public:
|
||||
DOMCDATASectionImpl(DOMDocument *ownerDoc, const XMLCh* data);
|
||||
DOMCDATASectionImpl(DOMDocument *ownerDoc, const XMLCh* data, XMLSize_t n);
|
||||
DOMCDATASectionImpl(const DOMCDATASectionImpl &other, bool deep = false);
|
||||
|
||||
virtual ~DOMCDATASectionImpl();
|
||||
|
||||
// Functions inherited from TEXT
|
||||
virtual DOMText* splitText(XMLSize_t offset);
|
||||
// DOM Level 3
|
||||
virtual bool getIsElementContentWhitespace() const;
|
||||
virtual const XMLCh* getWholeText() const;
|
||||
virtual DOMText* replaceWholeText(const XMLCh* content);
|
||||
|
||||
// non-standard extension
|
||||
virtual bool isIgnorableWhitespace() const;
|
||||
|
||||
|
||||
public:
|
||||
// Declare all of the functions from DOMNode.
|
||||
DOMNODE_FUNCTIONS;
|
||||
|
||||
public:
|
||||
// Functions introduced by DOMCharacterData
|
||||
virtual const XMLCh* getData() const;
|
||||
virtual XMLSize_t getLength() const;
|
||||
virtual const XMLCh* substringData(XMLSize_t offset,
|
||||
XMLSize_t count) const;
|
||||
virtual void appendData(const XMLCh *arg);
|
||||
virtual void insertData(XMLSize_t offset, const XMLCh *arg);
|
||||
virtual void deleteData(XMLSize_t offset,
|
||||
XMLSize_t count);
|
||||
virtual void replaceData(XMLSize_t offset,
|
||||
XMLSize_t count,
|
||||
const XMLCh *arg);
|
||||
virtual void setData(const XMLCh *data);
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMCDATASectionImpl & operator = (const DOMCDATASectionImpl &);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMCasts.hpp 673975 2008-07-04 09:23:56Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMCASTS_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMCASTS_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
//
|
||||
// Define inline casting functions to convert from
|
||||
// (DOMNode *) to DOMParentNode or DOMChildNode *.
|
||||
//
|
||||
// This requires knowledge of the structure of the fields of
|
||||
// for all node types. There are three categories -
|
||||
//
|
||||
// Nodetypes that can have children and can be a child themselves.
|
||||
// e.g. Elements
|
||||
//
|
||||
// Object
|
||||
// DOMNodeImpl fNode;
|
||||
// DOMParentNode fParent;
|
||||
// DOMChildNode fChild;
|
||||
// ... // other fields, depending on node type.
|
||||
//
|
||||
// Nodetypes that can not have children, e.g. TEXT
|
||||
//
|
||||
// Object
|
||||
// DOMNodeImpl fNode;
|
||||
// DOMChildNode fChild;
|
||||
// ... // other fields, depending on node type
|
||||
//
|
||||
// Nodetypes that can not be a child of other nodes, but that can
|
||||
// have children (are a parent) e.g. ATTR
|
||||
// Object
|
||||
// DOMNodeImpl fNode;
|
||||
// DOMParentNode fParent
|
||||
// ... // other fields, depending on node type
|
||||
//
|
||||
// The casting functions make these assumptions:
|
||||
// 1. The cast is possible. Using code will not attempt to
|
||||
// cast to something that does not exist, such as the child
|
||||
// part of an ATTR
|
||||
//
|
||||
// 2. The nodes belong to this implementation.
|
||||
//
|
||||
// Some of the casts use the LEAFNODE flag in the common fNode part to
|
||||
// determine whether an fParent field exists, and thus the
|
||||
// position of the fChild part within the node.
|
||||
//
|
||||
// These functions also cast off const. It was either do that, or make
|
||||
// a second overloaded set that took and returned const arguements.
|
||||
//
|
||||
|
||||
//
|
||||
// Note that using offsetof, or taking the offset of an object member at
|
||||
// a 0 address, is now undefined in C++. And gcc now warns about this behavior.
|
||||
// This is because doing do so is unreliable for some types of objects.
|
||||
// See: http://gcc.gnu.org/ml/gcc/2004-06/msg00227.html
|
||||
// : http://gcc.gnu.org/ml/gcc-bugs/2000-03/msg00805.html
|
||||
// The casting code below works around gcc's warnings by using a dummy
|
||||
// pointer, which the compiler cannot tell is null. The defeats the warning,
|
||||
// but also masks the potential problem.
|
||||
// The gcc option -Wno-invalid-offsetof may also be used to turn off this warning.
|
||||
//
|
||||
|
||||
#include "DOMElementImpl.hpp"
|
||||
#include "DOMTextImpl.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
static inline DOMNodeImpl *castToNodeImpl(const DOMNode *p)
|
||||
{
|
||||
DOMElementImpl *pE = (DOMElementImpl *)p;
|
||||
return &(pE->fNode);
|
||||
}
|
||||
|
||||
|
||||
static inline DOMParentNode *castToParentImpl(const DOMNode *p) {
|
||||
DOMElementImpl *pE = (DOMElementImpl *)p;
|
||||
return &(pE->fParent);
|
||||
}
|
||||
|
||||
|
||||
static inline DOMChildNode *castToChildImpl(const DOMNode *p) {
|
||||
DOMElementImpl *pE = (DOMElementImpl *)p;
|
||||
if (pE->fNode.isLeafNode()) {
|
||||
DOMTextImpl *pT = (DOMTextImpl *)p;
|
||||
return &(pT->fChild);
|
||||
}
|
||||
return &(pE->fChild);
|
||||
}
|
||||
|
||||
|
||||
static inline DOMNode *castToNode(const DOMParentNode *p ) {
|
||||
DOMElementImpl* dummy = 0;
|
||||
XMLSize_t parentOffset = (char *)&(dummy->fParent) - (char *)dummy;
|
||||
char *retPtr = (char *)p - parentOffset;
|
||||
return (DOMNode *)retPtr;
|
||||
}
|
||||
|
||||
static inline DOMNode *castToNode(const DOMNodeImpl *p) {
|
||||
DOMElementImpl* dummy = 0;
|
||||
XMLSize_t nodeImplOffset = (char *)&(dummy->fNode) - (char *)dummy;
|
||||
char *retPtr = (char *)p - nodeImplOffset;
|
||||
return (DOMNode *)retPtr;
|
||||
}
|
||||
|
||||
|
||||
static inline DOMNodeImpl *castToNodeImpl(const DOMParentNode *p)
|
||||
{
|
||||
DOMElementImpl* dummy = 0;
|
||||
XMLSize_t nodeImplOffset = (char *)&(dummy->fNode) - (char *)dummy;
|
||||
XMLSize_t parentOffset = (char *)&(dummy->fParent) - (char *)dummy;
|
||||
char *retPtr = (char *)p - parentOffset + nodeImplOffset;
|
||||
return (DOMNodeImpl *)retPtr;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,318 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMCharacterDataImpl.cpp 678766 2008-07-22 14:00:16Z borisk $
|
||||
*/
|
||||
|
||||
#include "DOMCharacterDataImpl.hpp"
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
#include "DOMRangeImpl.hpp"
|
||||
#include "DOMDocumentImpl.hpp"
|
||||
#include "DOMCasts.hpp"
|
||||
#include "DOMStringPool.hpp"
|
||||
#include <xercesc/util/XMLUniDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
DOMCharacterDataImpl::DOMCharacterDataImpl(DOMDocument *doc, const XMLCh *dat)
|
||||
{
|
||||
fDoc = (DOMDocumentImpl*)doc;
|
||||
|
||||
XMLSize_t len=XMLString::stringLen(dat);
|
||||
fDataBuf = fDoc->popBuffer(len+1);
|
||||
if (!fDataBuf)
|
||||
fDataBuf = new (fDoc) DOMBuffer(fDoc, len+15);
|
||||
fDataBuf->set(dat, len);
|
||||
}
|
||||
|
||||
DOMCharacterDataImpl::
|
||||
DOMCharacterDataImpl(DOMDocument *doc, const XMLCh* dat, XMLSize_t len)
|
||||
{
|
||||
fDoc = (DOMDocumentImpl*)doc;
|
||||
|
||||
fDataBuf = fDoc->popBuffer(len+1);
|
||||
|
||||
if (!fDataBuf)
|
||||
fDataBuf = new (fDoc) DOMBuffer(fDoc, len+15);
|
||||
|
||||
fDataBuf->set(dat, len);
|
||||
}
|
||||
|
||||
DOMCharacterDataImpl::DOMCharacterDataImpl(const DOMCharacterDataImpl &other)
|
||||
{
|
||||
fDoc = (DOMDocumentImpl*)other.fDoc;
|
||||
|
||||
XMLSize_t len=other.getLength();
|
||||
fDataBuf = fDoc->popBuffer(len+1);
|
||||
if (!fDataBuf)
|
||||
fDataBuf = new (fDoc) DOMBuffer(fDoc, len+15);
|
||||
fDataBuf->set(other.fDataBuf->getRawBuffer(), len);
|
||||
}
|
||||
|
||||
|
||||
DOMCharacterDataImpl::~DOMCharacterDataImpl() {
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMCharacterDataImpl::getNodeValue() const
|
||||
{
|
||||
return fDataBuf->getRawBuffer();
|
||||
}
|
||||
|
||||
|
||||
void DOMCharacterDataImpl::setNodeValue(const DOMNode *node, const XMLCh *value)
|
||||
{
|
||||
if (castToNodeImpl(node)->isReadOnly())
|
||||
throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
|
||||
fDataBuf->set(value);
|
||||
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl *)node->getOwnerDocument();
|
||||
if (doc != 0) {
|
||||
Ranges* ranges = doc->getRanges();
|
||||
if (ranges != 0) {
|
||||
XMLSize_t sz = ranges->size();
|
||||
if (sz != 0) {
|
||||
for (XMLSize_t i =0; i<sz; i++) {
|
||||
ranges->elementAt(i)->receiveReplacedText((DOMNode*)node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DOMCharacterDataImpl::appendData(const DOMNode *node, const XMLCh *dat)
|
||||
{
|
||||
if(castToNodeImpl(node)->isReadOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
|
||||
|
||||
fDataBuf->append(dat);
|
||||
}
|
||||
|
||||
void DOMCharacterDataImpl::appendData(const DOMNode *node, const XMLCh *dat, XMLSize_t n)
|
||||
{
|
||||
if(castToNodeImpl(node)->isReadOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
|
||||
|
||||
fDataBuf->append(dat, n);
|
||||
}
|
||||
|
||||
void DOMCharacterDataImpl::deleteData(const DOMNode *node, XMLSize_t offset, XMLSize_t count)
|
||||
{
|
||||
if (castToNodeImpl(node)->isReadOnly())
|
||||
throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
|
||||
|
||||
// Note: the C++ XMLCh * operation throws the correct DOMExceptions
|
||||
// when parameter values are bad.
|
||||
//
|
||||
|
||||
XMLSize_t len = this->fDataBuf->getLen();
|
||||
if (offset > len)
|
||||
throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMCharacterDataImplMemoryManager);
|
||||
|
||||
|
||||
|
||||
// Cap the value of delLength to avoid trouble with overflows
|
||||
// in the following length computations.
|
||||
if (count > len)
|
||||
count = len;
|
||||
|
||||
// If the length of data to be deleted would extend off the end
|
||||
// of the string, cut it back to stop at the end of string.
|
||||
if (offset + count >= len)
|
||||
count = len - offset;
|
||||
|
||||
XMLSize_t newLen = len - count;
|
||||
|
||||
XMLCh* newString;
|
||||
XMLCh temp[4096];
|
||||
if (newLen >= 4095)
|
||||
newString = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate
|
||||
(
|
||||
(newLen+1) * sizeof(XMLCh)
|
||||
);//new XMLCh[newLen+1];
|
||||
else
|
||||
newString = temp;
|
||||
|
||||
XMLString::copyNString(newString, fDataBuf->getRawBuffer(), offset);
|
||||
XMLString::copyString(newString+offset, fDataBuf->getRawBuffer()+offset+count);
|
||||
|
||||
fDataBuf->set(newString);
|
||||
|
||||
if (newLen >= 4095)
|
||||
XMLPlatformUtils::fgMemoryManager->deallocate(newString);//delete[] newString;
|
||||
|
||||
// We don't delete the old string (doesn't work), or alter
|
||||
// the old string (may be shared)
|
||||
// It just hangs around, possibly orphaned.
|
||||
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl *)node->getOwnerDocument();
|
||||
if (doc != 0) {
|
||||
Ranges* ranges = doc->getRanges();
|
||||
if (ranges != 0) {
|
||||
XMLSize_t sz = ranges->size();
|
||||
if (sz != 0) {
|
||||
for (XMLSize_t i =0; i<sz; i++) {
|
||||
ranges->elementAt(i)->updateRangeForDeletedText( (DOMNode*)node, offset, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
const XMLCh *DOMCharacterDataImpl::getData() const
|
||||
{
|
||||
return fDataBuf->getRawBuffer();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// getCharDataLength - return the length of the character data string.
|
||||
//
|
||||
XMLSize_t DOMCharacterDataImpl::getLength() const
|
||||
{
|
||||
return fDataBuf->getLen();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DOMCharacterDataImpl::insertData(const DOMNode *node, XMLSize_t offset, const XMLCh *dat)
|
||||
{
|
||||
if (castToNodeImpl(node)->isReadOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
|
||||
|
||||
// Note: the C++ XMLCh * operation throws the correct DOMExceptions
|
||||
// when parameter values are bad.
|
||||
//
|
||||
|
||||
XMLSize_t len = fDataBuf->getLen();
|
||||
if (offset > len)
|
||||
throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMCharacterDataImplMemoryManager);
|
||||
|
||||
XMLSize_t datLen = XMLString::stringLen(dat);
|
||||
|
||||
XMLSize_t newLen = len + datLen;
|
||||
|
||||
XMLCh* newString;
|
||||
XMLCh temp[4096];
|
||||
if (newLen >= 4095)
|
||||
newString = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate
|
||||
(
|
||||
(newLen + 1) * sizeof(XMLCh)
|
||||
);//new XMLCh[newLen+1];
|
||||
else
|
||||
newString = temp;
|
||||
|
||||
XMLString::copyNString(newString, fDataBuf->getRawBuffer(), offset);
|
||||
XMLString::copyNString(newString+offset, dat, datLen);
|
||||
XMLString::copyString(newString+offset+datLen, fDataBuf->getRawBuffer()+offset);
|
||||
|
||||
fDataBuf->set(newString);
|
||||
|
||||
if (newLen >= 4095)
|
||||
XMLPlatformUtils::fgMemoryManager->deallocate(newString);//delete[] newString;
|
||||
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl *)node->getOwnerDocument();
|
||||
if (doc != 0) {
|
||||
Ranges* ranges = doc->getRanges();
|
||||
if (ranges != 0) {
|
||||
XMLSize_t sz = ranges->size();
|
||||
if (sz != 0) {
|
||||
for (XMLSize_t i =0; i<sz; i++) {
|
||||
ranges->elementAt(i)->updateRangeForInsertedText( (DOMNode*)node, offset, datLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DOMCharacterDataImpl::replaceData(const DOMNode *node, XMLSize_t offset, XMLSize_t count,
|
||||
const XMLCh *dat)
|
||||
{
|
||||
if (castToNodeImpl(node)->isReadOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
|
||||
|
||||
deleteData(node, offset, count);
|
||||
insertData(node, offset, dat);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void DOMCharacterDataImpl::setData(const DOMNode *node, const XMLCh *arg)
|
||||
{
|
||||
setNodeValue(node, arg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const XMLCh * DOMCharacterDataImpl::substringData(const DOMNode *node, XMLSize_t offset,
|
||||
XMLSize_t count) const
|
||||
{
|
||||
|
||||
// Note: the C++ XMLCh * operation throws the correct DOMExceptions
|
||||
// when parameter values are bad.
|
||||
//
|
||||
|
||||
|
||||
XMLSize_t len = fDataBuf->getLen();
|
||||
|
||||
if (offset > len)
|
||||
throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMCharacterDataImplMemoryManager);
|
||||
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl *)node->getOwnerDocument();
|
||||
|
||||
XMLCh* newString;
|
||||
XMLCh temp[4096];
|
||||
if (len >= 4095)
|
||||
newString = (XMLCh*) doc->getMemoryManager()->allocate
|
||||
(
|
||||
(len + 1) * sizeof(XMLCh)
|
||||
);//new XMLCh[len+1];
|
||||
else
|
||||
newString = temp;
|
||||
|
||||
XMLString::copyNString(newString, fDataBuf->getRawBuffer()+offset, count);
|
||||
newString[count] = chNull;
|
||||
|
||||
const XMLCh* retString = doc->getPooledString(newString);
|
||||
|
||||
if (len >= 4095)
|
||||
doc->getMemoryManager()->deallocate(newString);//delete[] newString;
|
||||
|
||||
return retString;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DOMCharacterDataImpl::releaseBuffer() {
|
||||
fDoc->releaseBuffer(fDataBuf);
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMCharacterDataImpl.hpp 678709 2008-07-22 10:56:56Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMCHARACTERDATAIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMCHARACTERDATAIMPL_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMNode;
|
||||
class DOMDocument;
|
||||
class DOMDocumentImpl;
|
||||
class DOMBuffer;
|
||||
|
||||
// Instances of DOMCharacterDataImpl appear as members of node types
|
||||
// that implement the DOMCharacterData interfaces.
|
||||
// Operations in those classes are delegated to this class.
|
||||
//
|
||||
class CDOM_EXPORT DOMCharacterDataImpl
|
||||
{
|
||||
public:
|
||||
DOMBuffer* fDataBuf;
|
||||
// for the buffer bid
|
||||
DOMDocumentImpl* fDoc;
|
||||
|
||||
public:
|
||||
DOMCharacterDataImpl(DOMDocument *doc, const XMLCh *dat);
|
||||
DOMCharacterDataImpl(DOMDocument *doc, const XMLCh* data, XMLSize_t n);
|
||||
DOMCharacterDataImpl(const DOMCharacterDataImpl &other);
|
||||
~DOMCharacterDataImpl();
|
||||
const XMLCh * getNodeValue() const;
|
||||
void setNodeValue(const XMLCh * value);
|
||||
void appendData(const DOMNode *node, const XMLCh *data);
|
||||
void appendData(const DOMNode *node, const XMLCh *data, XMLSize_t n);
|
||||
void deleteData(const DOMNode *node, XMLSize_t offset, XMLSize_t count);
|
||||
const XMLCh* getData() const;
|
||||
XMLSize_t getLength() const;
|
||||
void insertData(const DOMNode *node, XMLSize_t offset, const XMLCh * data);
|
||||
void replaceData(const DOMNode *node, XMLSize_t offset, XMLSize_t count, const XMLCh * data);
|
||||
void setData(const DOMNode *node, const XMLCh * arg);
|
||||
void setNodeValue(const DOMNode *node, const XMLCh *value);
|
||||
|
||||
|
||||
const XMLCh* substringData(const DOMNode *node, XMLSize_t offset, XMLSize_t count) const;
|
||||
void releaseBuffer();
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMCharacterDataImpl & operator = (const DOMCharacterDataImpl &);
|
||||
};
|
||||
|
||||
#define GetDOMCharacterDataImplMemoryManager GET_DIRECT_MM(fDoc)
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMChildNode.cpp 471747 2006-11-06 14:31:56Z amassari $
|
||||
*/
|
||||
|
||||
// This class only adds the ability to have siblings
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include "DOMNodeImpl.hpp"
|
||||
#include "DOMChildNode.hpp"
|
||||
#include "DOMCasts.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
DOMChildNode::DOMChildNode()
|
||||
{
|
||||
this->previousSibling = 0;
|
||||
this->nextSibling = 0;
|
||||
}
|
||||
|
||||
// This only makes a shallow copy, cloneChildren must also be called for a
|
||||
// deep clone
|
||||
DOMChildNode::DOMChildNode(const DOMChildNode &)
|
||||
{
|
||||
// Need to break the association w/ original siblings and parent
|
||||
this->previousSibling = 0;
|
||||
this->nextSibling = 0;
|
||||
}
|
||||
|
||||
DOMChildNode::~DOMChildNode() {
|
||||
}
|
||||
|
||||
|
||||
DOMNode * DOMChildNode::getNextSibling() const {
|
||||
return nextSibling;
|
||||
}
|
||||
|
||||
//
|
||||
// Note: for getParentNode and getPreviousSibling(), below, an
|
||||
// extra paramter "thisNode" is required. This is because there
|
||||
// is no way to cast from a DOMChildNode pointer back to the
|
||||
// DOMNodeImpl that it is part of. Our "this" may or may not
|
||||
// be preceded by a fParent in the object layout, and there's no
|
||||
// practical way to tell, so we just take an extra parameter instead.
|
||||
|
||||
DOMNode * DOMChildNode::getParentNode(const DOMNode *thisNode) const
|
||||
{
|
||||
// if we have an owner, ownerNode is our parent, otherwise it's
|
||||
// our ownerDocument and we don't have a parent
|
||||
DOMNodeImpl *thisNodeImpl = castToNodeImpl(thisNode);
|
||||
return thisNodeImpl->isOwned() ? thisNodeImpl->fOwnerNode : 0;
|
||||
}
|
||||
|
||||
DOMNode * DOMChildNode::getPreviousSibling(const DOMNode *thisNode) const {
|
||||
// if we are the firstChild, previousSibling actually refers to our
|
||||
// parent's lastChild, but we hide that
|
||||
return castToNodeImpl(thisNode)->isFirstChild() ? 0 : previousSibling;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMChildNode.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMCHILDNODE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMCHILDNODE_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
/**
|
||||
* ChildNode adds to NodeImpl the capability of being a child, this is having
|
||||
* siblings.
|
||||
**/
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMDocument;
|
||||
class DOMNode;
|
||||
|
||||
|
||||
class CDOM_EXPORT DOMChildNode {
|
||||
|
||||
public:
|
||||
DOMNode *previousSibling;
|
||||
DOMNode *nextSibling;
|
||||
|
||||
DOMChildNode();
|
||||
DOMChildNode(const DOMChildNode &other);
|
||||
~DOMChildNode();
|
||||
|
||||
DOMNode * getNextSibling() const;
|
||||
DOMNode * getParentNode(const DOMNode *thisNode) const;
|
||||
DOMNode * getPreviousSibling(const DOMNode *thisNode) const;
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMChildNode & operator = (const DOMChildNode &);
|
||||
};
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMCommentImpl.cpp 678381 2008-07-21 10:15:01Z borisk $
|
||||
*/
|
||||
|
||||
#include "DOMCommentImpl.hpp"
|
||||
#include "DOMCharacterDataImpl.hpp"
|
||||
#include "DOMStringPool.hpp"
|
||||
#include "DOMCasts.hpp"
|
||||
#include "DOMDocumentImpl.hpp"
|
||||
#include "DOMRangeImpl.hpp"
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
#include <xercesc/util/XMLUniDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
DOMCommentImpl::DOMCommentImpl(DOMDocument *ownerDoc, const XMLCh *dat)
|
||||
: fNode(ownerDoc), fCharacterData(ownerDoc, dat)
|
||||
{
|
||||
fNode.setIsLeafNode(true);
|
||||
}
|
||||
|
||||
|
||||
DOMCommentImpl::DOMCommentImpl(const DOMCommentImpl &other, bool)
|
||||
|
||||
: fNode(other.fNode),
|
||||
fChild(other.fChild),
|
||||
fCharacterData(other.fCharacterData)
|
||||
{
|
||||
fNode.setIsLeafNode(true);
|
||||
}
|
||||
|
||||
|
||||
DOMCommentImpl::~DOMCommentImpl() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
DOMNode * DOMCommentImpl::cloneNode(bool deep) const
|
||||
{
|
||||
DOMNode* newNode = new (getOwnerDocument(), DOMMemoryManager::COMMENT_OBJECT) DOMCommentImpl(*this, deep);
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
|
||||
return newNode;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMCommentImpl::getNodeName() const {
|
||||
static const XMLCh gComment[] =
|
||||
{chPound, chLatin_c, chLatin_o, chLatin_m, chLatin_m, chLatin_e,chLatin_n, chLatin_t, 0};
|
||||
return gComment;
|
||||
}
|
||||
|
||||
DOMNode::NodeType DOMCommentImpl::getNodeType() const {
|
||||
return DOMNode::COMMENT_NODE;
|
||||
}
|
||||
|
||||
void DOMCommentImpl::release()
|
||||
{
|
||||
if (fNode.isOwned() && !fNode.isToBeReleased())
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
|
||||
if (doc) {
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
|
||||
fCharacterData.releaseBuffer();
|
||||
doc->release(this, DOMMemoryManager::COMMENT_OBJECT);
|
||||
}
|
||||
else {
|
||||
// shouldn't reach here
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Non standard extension for the range to work
|
||||
DOMComment *DOMCommentImpl::splitText(XMLSize_t offset)
|
||||
{
|
||||
if (fNode.isReadOnly())
|
||||
{
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
XMLSize_t len = fCharacterData.fDataBuf->getLen();
|
||||
if (offset > len)
|
||||
throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl *)getOwnerDocument();
|
||||
DOMComment *newText =
|
||||
doc->createComment(this->substringData(offset, len - offset));
|
||||
|
||||
DOMNode *parent = getParentNode();
|
||||
if (parent != 0)
|
||||
parent->insertBefore(newText, getNextSibling());
|
||||
|
||||
fCharacterData.fDataBuf->chop(offset);
|
||||
|
||||
if (doc != 0) {
|
||||
Ranges* ranges = doc->getRanges();
|
||||
if (ranges != 0) {
|
||||
XMLSize_t sz = ranges->size();
|
||||
if (sz != 0) {
|
||||
for (XMLSize_t i =0; i<sz; i++) {
|
||||
ranges->elementAt(i)->updateSplitInfo( this, newText, offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return newText;
|
||||
}
|
||||
|
||||
|
||||
DOMNode* DOMCommentImpl::appendChild(DOMNode *newChild) {return fNode.appendChild (newChild); }
|
||||
DOMNamedNodeMap* DOMCommentImpl::getAttributes() const {return fNode.getAttributes (); }
|
||||
DOMNodeList* DOMCommentImpl::getChildNodes() const {return fNode.getChildNodes (); }
|
||||
DOMNode* DOMCommentImpl::getFirstChild() const {return fNode.getFirstChild (); }
|
||||
DOMNode* DOMCommentImpl::getLastChild() const {return fNode.getLastChild (); }
|
||||
const XMLCh* DOMCommentImpl::getLocalName() const {return fNode.getLocalName (); }
|
||||
const XMLCh* DOMCommentImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); }
|
||||
DOMNode* DOMCommentImpl::getNextSibling() const {return fChild.getNextSibling (); }
|
||||
const XMLCh* DOMCommentImpl::getNodeValue() const {return fCharacterData.getNodeValue (); }
|
||||
DOMDocument* DOMCommentImpl::getOwnerDocument() const {return fNode.getOwnerDocument (); }
|
||||
const XMLCh* DOMCommentImpl::getPrefix() const {return fNode.getPrefix (); }
|
||||
DOMNode* DOMCommentImpl::getParentNode() const {return fChild.getParentNode (this); }
|
||||
DOMNode* DOMCommentImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); }
|
||||
bool DOMCommentImpl::hasChildNodes() const {return fNode.hasChildNodes (); }
|
||||
DOMNode* DOMCommentImpl::insertBefore(DOMNode *newChild, DOMNode *refChild)
|
||||
{return fNode.insertBefore (newChild, refChild); }
|
||||
void DOMCommentImpl::normalize() {fNode.normalize (); }
|
||||
DOMNode* DOMCommentImpl::removeChild(DOMNode *oldChild) {return fNode.removeChild (oldChild); }
|
||||
DOMNode* DOMCommentImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild)
|
||||
{return fNode.replaceChild (newChild, oldChild); }
|
||||
bool DOMCommentImpl::isSupported(const XMLCh *feature, const XMLCh *version) const
|
||||
{return fNode.isSupported (feature, version); }
|
||||
void DOMCommentImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); }
|
||||
bool DOMCommentImpl::hasAttributes() const {return fNode.hasAttributes(); }
|
||||
bool DOMCommentImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); }
|
||||
bool DOMCommentImpl::isEqualNode(const DOMNode* arg) const {return fNode.isEqualNode(arg); }
|
||||
void* DOMCommentImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler)
|
||||
{return fNode.setUserData(key, data, handler); }
|
||||
void* DOMCommentImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); }
|
||||
const XMLCh* DOMCommentImpl::getBaseURI() const {return fNode.getBaseURI(); }
|
||||
short DOMCommentImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); }
|
||||
const XMLCh* DOMCommentImpl::getTextContent() const {return fNode.getTextContent(); }
|
||||
void DOMCommentImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); }
|
||||
const XMLCh* DOMCommentImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); }
|
||||
bool DOMCommentImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); }
|
||||
const XMLCh* DOMCommentImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); }
|
||||
void* DOMCommentImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); }
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Delegation of CharacerData functions.
|
||||
//
|
||||
|
||||
|
||||
const XMLCh* DOMCommentImpl::getData() const {return fCharacterData.getData();}
|
||||
XMLSize_t DOMCommentImpl::getLength() const {return fCharacterData.getLength();}
|
||||
const XMLCh* DOMCommentImpl::substringData(XMLSize_t offset, XMLSize_t count) const
|
||||
{return fCharacterData.substringData(this, offset, count);}
|
||||
void DOMCommentImpl::appendData(const XMLCh *arg) {fCharacterData.appendData(this, arg);}
|
||||
void DOMCommentImpl::insertData(XMLSize_t offset, const XMLCh *arg)
|
||||
{fCharacterData.insertData(this, offset, arg);}
|
||||
void DOMCommentImpl::deleteData(XMLSize_t offset, XMLSize_t count)
|
||||
{fCharacterData.deleteData(this, offset, count);}
|
||||
void DOMCommentImpl::replaceData(XMLSize_t offset, XMLSize_t count, const XMLCh *arg)
|
||||
{fCharacterData.replaceData(this, offset, count, arg);}
|
||||
void DOMCommentImpl::setData(const XMLCh *data) {fCharacterData.setData(this, data);}
|
||||
void DOMCommentImpl::setNodeValue(const XMLCh *nodeValue) {fCharacterData.setNodeValue (this, nodeValue); }
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMCommentImpl.hpp 676911 2008-07-15 13:27:32Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMCOMMENTIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMCOMMENTIMPL_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMComment.hpp>
|
||||
|
||||
#include "DOMNodeImpl.hpp"
|
||||
#include "DOMChildNode.hpp"
|
||||
#include "DOMCharacterDataImpl.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class CDOM_EXPORT DOMCommentImpl: public DOMComment {
|
||||
public:
|
||||
DOMNodeImpl fNode;
|
||||
DOMChildNode fChild;
|
||||
DOMCharacterDataImpl fCharacterData;
|
||||
|
||||
public:
|
||||
DOMCommentImpl(DOMDocument *, const XMLCh *);
|
||||
DOMCommentImpl(const DOMCommentImpl &other, bool deep);
|
||||
virtual ~DOMCommentImpl();
|
||||
|
||||
public:
|
||||
// Declare all of the functions from DOMNode.
|
||||
DOMNODE_FUNCTIONS;
|
||||
|
||||
public:
|
||||
// Functions from DOMCharacterData
|
||||
virtual void appendData(const XMLCh *data);
|
||||
virtual void deleteData(XMLSize_t offset, XMLSize_t count);
|
||||
virtual const XMLCh * getData() const;
|
||||
virtual XMLSize_t getLength() const;
|
||||
virtual void insertData(XMLSize_t offset, const XMLCh * data);
|
||||
virtual void replaceData(XMLSize_t offset, XMLSize_t count, const XMLCh * data);
|
||||
virtual void setData(const XMLCh * arg);
|
||||
virtual const XMLCh * substringData(XMLSize_t offset, XMLSize_t count) const;
|
||||
|
||||
// Non standard extension for the range to work
|
||||
DOMComment* splitText(XMLSize_t offset);
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMCommentImpl & operator = (const DOMCommentImpl &);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,271 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "DOMConfigurationImpl.hpp"
|
||||
#include "DOMStringListImpl.hpp"
|
||||
#include <xercesc/dom/DOMErrorHandler.hpp>
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
#include <xercesc/util/XMLUniDefs.hpp>
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
const unsigned short DOMConfigurationImpl::fDEFAULT_VALUES = 0x2596;
|
||||
|
||||
DOMConfigurationImpl::DOMConfigurationImpl(MemoryManager* const manager): featureValues(fDEFAULT_VALUES),
|
||||
fErrorHandler(0), fSchemaType(0), fSchemaLocation(0),
|
||||
fSupportedParameters(0), fMemoryManager(manager)
|
||||
{
|
||||
fSupportedParameters=new (fMemoryManager) DOMStringListImpl(17, fMemoryManager);
|
||||
fSupportedParameters->add(XMLUni::fgDOMErrorHandler);
|
||||
fSupportedParameters->add(XMLUni::fgDOMSchemaType);
|
||||
fSupportedParameters->add(XMLUni::fgDOMSchemaLocation);
|
||||
fSupportedParameters->add(XMLUni::fgDOMCanonicalForm);
|
||||
fSupportedParameters->add(XMLUni::fgDOMCDATASections);
|
||||
fSupportedParameters->add(XMLUni::fgDOMComments);
|
||||
fSupportedParameters->add(XMLUni::fgDOMDatatypeNormalization);
|
||||
fSupportedParameters->add(XMLUni::fgDOMWRTDiscardDefaultContent);
|
||||
fSupportedParameters->add(XMLUni::fgDOMEntities);
|
||||
fSupportedParameters->add(XMLUni::fgDOMInfoset);
|
||||
fSupportedParameters->add(XMLUni::fgDOMNamespaces);
|
||||
fSupportedParameters->add(XMLUni::fgDOMNamespaceDeclarations);
|
||||
fSupportedParameters->add(XMLUni::fgDOMNormalizeCharacters);
|
||||
fSupportedParameters->add(XMLUni::fgDOMSplitCDATASections);
|
||||
fSupportedParameters->add(XMLUni::fgDOMValidate);
|
||||
fSupportedParameters->add(XMLUni::fgDOMValidateIfSchema);
|
||||
fSupportedParameters->add(XMLUni::fgDOMElementContentWhitespace);
|
||||
}
|
||||
|
||||
DOMConfigurationImpl::~DOMConfigurationImpl() {
|
||||
delete fSupportedParameters;
|
||||
}
|
||||
|
||||
void DOMConfigurationImpl::setParameter(const XMLCh* name, const void* value) {
|
||||
if(!canSetParameter(name, value)) {
|
||||
throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, fMemoryManager);
|
||||
}
|
||||
|
||||
if(XMLString::compareIStringASCII(name, XMLUni::fgDOMErrorHandler)==0) {
|
||||
fErrorHandler = (DOMErrorHandler*)value;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaType)==0) {
|
||||
fSchemaType = (XMLCh*)value;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaLocation)==0) {
|
||||
fSchemaLocation = (XMLCh*)value;
|
||||
} else { // canSetParameter above should take care of this case
|
||||
throw DOMException(DOMException::NOT_FOUND_ERR, 0, fMemoryManager);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DOMConfigurationImpl::setParameter(const XMLCh* name, bool value) {
|
||||
if(!canSetParameter(name, value)) {
|
||||
throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, fMemoryManager);
|
||||
}
|
||||
|
||||
DOMConfigurationFeature whichFlag = getFeatureFlag(name);
|
||||
if(value) {
|
||||
featureValues |= whichFlag;
|
||||
} else {
|
||||
featureValues &= ~whichFlag;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// --------------------------------------
|
||||
// Getter Methods
|
||||
// --------------------------------------
|
||||
|
||||
const void* DOMConfigurationImpl::getParameter(const XMLCh* name) const {
|
||||
DOMConfigurationFeature whichFlag;
|
||||
try {
|
||||
whichFlag = getFeatureFlag(name);
|
||||
if(featureValues & whichFlag) {
|
||||
return (void*)true;
|
||||
} else {
|
||||
return (void*)false;
|
||||
}
|
||||
} catch (DOMException&) {
|
||||
// must not be a boolean parameter
|
||||
if(XMLString::compareIStringASCII(name, XMLUni::fgDOMErrorHandler)==0) {
|
||||
return fErrorHandler;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaType)==0) {
|
||||
return fSchemaType;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaLocation)==0) {
|
||||
return fSchemaLocation;
|
||||
} else {
|
||||
throw DOMException(DOMException::NOT_FOUND_ERR, 0, fMemoryManager);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
// Query Methods
|
||||
// -----------------------------------------
|
||||
|
||||
bool DOMConfigurationImpl::canSetParameter(const XMLCh* name, const void* /*value*/) const {
|
||||
|
||||
/**
|
||||
* canSetParameter(name, value) returns false in two conditions:
|
||||
* 1) if a [required] feature has no supporting code, then return false in
|
||||
* both the true and false outcomes (This is in order to be either fully
|
||||
* spec compliant, or not at all)
|
||||
* 2) if an [optional] feature has no supporting code, then return false
|
||||
**/
|
||||
|
||||
if(XMLString::compareIStringASCII(name, XMLUni::fgDOMErrorHandler)==0) {
|
||||
return true; // required //
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaType)==0) {
|
||||
return false; // optional //
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaLocation)==0) {
|
||||
return false; // optional //
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DOMConfigurationImpl::canSetParameter(const XMLCh* name, bool booleanValue) const {
|
||||
/**
|
||||
* canSetParameter(name, value) returns false in two conditions:
|
||||
* 1) if a [required] feature has no supporting code, then return false in
|
||||
* both the true and false outcomes (This is in order to be either fully
|
||||
* spec compliant, or not at all)
|
||||
* 2) if an [optional] feature has no supporting code, then return false
|
||||
**/
|
||||
|
||||
DOMConfigurationFeature whichFlag = getFeatureFlag(name);
|
||||
switch (whichFlag) {
|
||||
case FEATURE_CANONICAL_FORM:
|
||||
if(booleanValue) return false; // optional //
|
||||
else return true; // required //
|
||||
case FEATURE_CDATA_SECTIONS:
|
||||
return true;
|
||||
case FEATURE_COMMENTS:
|
||||
return true;
|
||||
case FEATURE_DATATYPE_NORMALIZATION:
|
||||
if(booleanValue) return false; // required //
|
||||
else return true; // required //
|
||||
case FEATURE_DISCARD_DEFAULT_CONTENT:
|
||||
if(booleanValue) return false; // required //
|
||||
else return true; // required //
|
||||
case FEATURE_ENTITIES:
|
||||
if(booleanValue) return true; // required //
|
||||
else return true; // required //
|
||||
case FEATURE_INFOSET:
|
||||
if(booleanValue) return false; // required //
|
||||
else return true; // no effect//
|
||||
case FEATURE_NAMESPACES:
|
||||
return true;
|
||||
case FEATURE_NAMESPACE_DECLARATIONS:
|
||||
if(booleanValue) return true; // optional //
|
||||
else return false; // required //
|
||||
case FEATURE_NORMALIZE_CHARACTERS:
|
||||
if(booleanValue) return false; // optional //
|
||||
else return true; // required //
|
||||
case FEATURE_SPLIT_CDATA_SECTIONS:
|
||||
//we dont report an error in the false case so we cant claim we do it
|
||||
if(booleanValue) return false; // required //
|
||||
else return false; // required //
|
||||
case FEATURE_VALIDATE:
|
||||
if(booleanValue) return false; // optional //
|
||||
else return true; // required //
|
||||
case FEATURE_VALIDATE_IF_SCHEMA:
|
||||
if(booleanValue) return false; // optional //
|
||||
else return true; // required //
|
||||
|
||||
case FEATURE_ELEMENT_CONTENT_WHITESPACE:
|
||||
if(booleanValue) return true; // required //
|
||||
else return false; // optional //
|
||||
}
|
||||
// should never be here
|
||||
return false;
|
||||
}
|
||||
|
||||
const DOMStringList* DOMConfigurationImpl::getParameterNames() const
|
||||
{
|
||||
return fSupportedParameters;
|
||||
}
|
||||
|
||||
// -------------------------------------------
|
||||
// Impl methods
|
||||
// -------------------------------------------
|
||||
|
||||
DOMConfigurationImpl::DOMConfigurationFeature DOMConfigurationImpl::getFeatureFlag(const XMLCh* name) const {
|
||||
if(XMLString::compareIStringASCII(name, XMLUni::fgDOMCanonicalForm)==0) {
|
||||
return FEATURE_CANONICAL_FORM;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMCDATASections )==0) {
|
||||
return FEATURE_CDATA_SECTIONS;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMComments)==0) {
|
||||
return FEATURE_COMMENTS;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMDatatypeNormalization)==0) {
|
||||
return FEATURE_DATATYPE_NORMALIZATION;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMWRTDiscardDefaultContent)==0) {
|
||||
return FEATURE_DISCARD_DEFAULT_CONTENT;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMEntities)==0) {
|
||||
return FEATURE_ENTITIES;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMInfoset)==0) {
|
||||
return FEATURE_INFOSET;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMNamespaces)==0) {
|
||||
return FEATURE_NAMESPACES;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMNamespaceDeclarations)==0) {
|
||||
return FEATURE_NAMESPACE_DECLARATIONS;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMNormalizeCharacters)==0) {
|
||||
return FEATURE_NORMALIZE_CHARACTERS;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSplitCDATASections)==0) {
|
||||
return FEATURE_SPLIT_CDATA_SECTIONS;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMValidate)==0) {
|
||||
return FEATURE_VALIDATE;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMValidateIfSchema)==0) {
|
||||
return FEATURE_VALIDATE_IF_SCHEMA;
|
||||
} else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMElementContentWhitespace)==0) {
|
||||
return FEATURE_ELEMENT_CONTENT_WHITESPACE;
|
||||
} else {
|
||||
throw DOMException(DOMException::NOT_FOUND_ERR, 0, fMemoryManager);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DOMErrorHandler* DOMConfigurationImpl::getErrorHandler() const {
|
||||
return fErrorHandler;
|
||||
}
|
||||
|
||||
const XMLCh* DOMConfigurationImpl::getSchemaType() const {
|
||||
return fSchemaType;
|
||||
}
|
||||
|
||||
const XMLCh* DOMConfigurationImpl::getSchemaLocation() const {
|
||||
return fSchemaLocation;
|
||||
}
|
||||
|
||||
void DOMConfigurationImpl::setErrorHandler(DOMErrorHandler *erHandler) {
|
||||
fErrorHandler = erHandler;
|
||||
}
|
||||
|
||||
void DOMConfigurationImpl::setSchemaType(const XMLCh* st) {
|
||||
fSchemaType = st;
|
||||
}
|
||||
|
||||
void DOMConfigurationImpl::setSchemaLocation(const XMLCh* sl) {
|
||||
fSchemaLocation = sl;
|
||||
}
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
|
||||
/**
|
||||
* End of file DOMConfigurationImpl.cpp
|
||||
*/
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMCONFIGURATIONIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMCONFIGURATIONIMPL_HPP
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Includes
|
||||
//------------------------------------------------------------------------------------
|
||||
#include <xercesc/dom/DOMConfiguration.hpp>
|
||||
#include <xercesc/dom/DOMErrorHandler.hpp>
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMDocumentImpl;
|
||||
class DOMStringListImpl;
|
||||
|
||||
class CDOM_EXPORT DOMConfigurationImpl : public DOMConfiguration
|
||||
{
|
||||
private:
|
||||
//unimplemented
|
||||
DOMConfigurationImpl(const DOMConfiguration &);
|
||||
DOMConfigurationImpl & operator = (const DOMConfiguration &);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
// Constructor
|
||||
//-----------------------------------------------------------------------------------
|
||||
DOMConfigurationImpl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
~DOMConfigurationImpl();
|
||||
|
||||
enum DOMConfigurationFeature {
|
||||
FEATURE_CANONICAL_FORM = 0x0001,
|
||||
FEATURE_CDATA_SECTIONS = 0x0002,
|
||||
FEATURE_COMMENTS = 0x0004,
|
||||
FEATURE_DATATYPE_NORMALIZATION = 0x0008,
|
||||
FEATURE_DISCARD_DEFAULT_CONTENT = 0x0010,
|
||||
FEATURE_ENTITIES = 0x0020,
|
||||
FEATURE_INFOSET = 0x0040,
|
||||
FEATURE_NAMESPACES = 0x0080,
|
||||
FEATURE_NAMESPACE_DECLARATIONS = 0x0100,
|
||||
FEATURE_NORMALIZE_CHARACTERS = 0x0200,
|
||||
FEATURE_SPLIT_CDATA_SECTIONS = 0x0400,
|
||||
FEATURE_VALIDATE = 0x0800,
|
||||
FEATURE_VALIDATE_IF_SCHEMA = 0x1000,
|
||||
FEATURE_ELEMENT_CONTENT_WHITESPACE = 0x2000
|
||||
};
|
||||
|
||||
unsigned short featureValues;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
virtual void setParameter(const XMLCh* name, const void* value);
|
||||
virtual void setParameter(const XMLCh* name, bool value);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
virtual const void* getParameter(const XMLCh* name) const;
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Query methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
virtual bool canSetParameter(const XMLCh* name, const void* value) const;
|
||||
virtual bool canSetParameter(const XMLCh* name, bool value) const;
|
||||
|
||||
virtual const DOMStringList* getParameterNames() const;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Impl specific methods
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* specific get and set methods for non-boolean parameters
|
||||
* */
|
||||
|
||||
DOMErrorHandler* getErrorHandler() const;
|
||||
|
||||
const XMLCh* getSchemaType() const;
|
||||
|
||||
const XMLCh* getSchemaLocation() const;
|
||||
|
||||
void setErrorHandler(DOMErrorHandler *erHandler);
|
||||
|
||||
void setSchemaType(const XMLCh* st);
|
||||
|
||||
void setSchemaLocation(const XMLCh* sl);
|
||||
|
||||
// The default values for the boolean parameters
|
||||
// from CANONICAL_FORM to ELEMENT_CONTENT_WHITESPACE
|
||||
// 10010110010110 = 0x2596
|
||||
static const unsigned short fDEFAULT_VALUES;
|
||||
|
||||
|
||||
protected:
|
||||
// implements a simple map between the name and its enum value
|
||||
DOMConfigurationFeature getFeatureFlag(const XMLCh* name) const;
|
||||
|
||||
// the error handler
|
||||
DOMErrorHandler* fErrorHandler;
|
||||
|
||||
// the schema type
|
||||
const XMLCh* fSchemaType;
|
||||
|
||||
// the schema location
|
||||
const XMLCh* fSchemaLocation;
|
||||
|
||||
// the list of supported parameters
|
||||
DOMStringListImpl* fSupportedParameters;
|
||||
|
||||
MemoryManager* fMemoryManager;
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* End of file DOMConfigurationImpl.hpp
|
||||
*/
|
||||
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMDeepNodeListImpl.cpp 678381 2008-07-21 10:15:01Z borisk $
|
||||
*/
|
||||
|
||||
#include "DOMDeepNodeListImpl.hpp"
|
||||
#include "DOMElementImpl.hpp"
|
||||
#include "DOMDocumentImpl.hpp"
|
||||
#include "DOMCasts.hpp"
|
||||
#include "DOMNodeImpl.hpp"
|
||||
#include <xercesc/util/XMLUniDefs.hpp>
|
||||
#include <limits.h>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
static const XMLCh kAstr[] = {chAsterisk, chNull};
|
||||
|
||||
DOMDeepNodeListImpl::DOMDeepNodeListImpl(const DOMNode *rootNode,
|
||||
const XMLCh *tagName)
|
||||
: fRootNode(rootNode)
|
||||
, fChanges(0)
|
||||
, fCurrentNode(0)
|
||||
, fCurrentIndexPlus1(0)
|
||||
, fNamespaceURI(0)
|
||||
, fMatchAllURI(false)
|
||||
, fMatchURIandTagname(false)
|
||||
{
|
||||
fTagName = ((DOMDocumentImpl *)(castToNodeImpl(rootNode)->getOwnerDocument()))->getPooledString(tagName);
|
||||
fMatchAll = XMLString::equals(fTagName, kAstr);
|
||||
}
|
||||
|
||||
|
||||
//DOM Level 2
|
||||
DOMDeepNodeListImpl::DOMDeepNodeListImpl(const DOMNode *rootNode,
|
||||
const XMLCh *namespaceURI,
|
||||
const XMLCh *localName)
|
||||
: fRootNode(rootNode)
|
||||
, fChanges(0)
|
||||
, fCurrentNode(0)
|
||||
, fCurrentIndexPlus1(0)
|
||||
, fMatchAllURI(false)
|
||||
, fMatchURIandTagname(true)
|
||||
{
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl *)castToNodeImpl(rootNode)->getOwnerDocument();
|
||||
|
||||
fTagName = doc->getPooledString(localName);
|
||||
fMatchAll = XMLString::equals(fTagName, kAstr);
|
||||
fMatchAllURI = XMLString::equals(namespaceURI, kAstr);
|
||||
fNamespaceURI = doc->getPooledString(namespaceURI);
|
||||
}
|
||||
|
||||
|
||||
DOMDeepNodeListImpl::~DOMDeepNodeListImpl()
|
||||
{
|
||||
}
|
||||
|
||||
XMLSize_t DOMDeepNodeListImpl::getLength() const
|
||||
{
|
||||
// Reset cache to beginning of list
|
||||
item(0);
|
||||
|
||||
// Preload all matching elements. (Stops when we run out of subtree!)
|
||||
item(INT_MAX);
|
||||
return fCurrentIndexPlus1;
|
||||
}
|
||||
|
||||
|
||||
DOMNode *DOMDeepNodeListImpl::item(XMLSize_t index) const
|
||||
{
|
||||
return ((DOMDeepNodeListImpl*)this)->cacheItem(index);
|
||||
}
|
||||
|
||||
// Start from the first child and count forward, 0-based. index>length-1
|
||||
// should return 0.
|
||||
//
|
||||
// Attempts to do only work actually requested, cache work already
|
||||
// done, and to flush that cache when the tree has changed.
|
||||
//
|
||||
// LIMITATION: ????? Unable to tell relevant tree-changes from
|
||||
// irrelevant ones. Doing so in a really useful manner would seem
|
||||
// to involve a tree-walk in its own right, or maintaining our data
|
||||
// in a parallel tree.
|
||||
DOMNode *DOMDeepNodeListImpl::cacheItem(XMLSize_t index)
|
||||
{
|
||||
XMLSize_t currentIndexPlus1 = fCurrentIndexPlus1;
|
||||
DOMNode *currentNode = fCurrentNode;
|
||||
|
||||
if (castToParentImpl(fRootNode)->changes() != fChanges)
|
||||
{
|
||||
// Tree changed. Do it all from scratch!
|
||||
currentIndexPlus1 = 0;
|
||||
currentNode = (DOMNode *)fRootNode;
|
||||
fChanges = castToParentImpl(fRootNode)->changes();
|
||||
}
|
||||
else if (currentIndexPlus1 > index+1)
|
||||
{
|
||||
// Interested in something before cached node. Do it all from scratch!
|
||||
currentIndexPlus1 = 0;
|
||||
currentNode = (DOMNode *)fRootNode;
|
||||
}
|
||||
else if (index+1 == currentIndexPlus1)
|
||||
{
|
||||
// What luck! User is interested in cached node.
|
||||
return currentNode;
|
||||
}
|
||||
|
||||
DOMNode *nextNode = 0;
|
||||
|
||||
// revisit - ???? How efficient is this loop? ????
|
||||
|
||||
// Start at the place in the tree at which we're
|
||||
// currently pointing and count off nodes until we
|
||||
// reach the node of interest or the end of the tree.
|
||||
while (currentIndexPlus1 < index+1 && currentNode != 0)
|
||||
{
|
||||
nextNode = nextMatchingElementAfter(currentNode);
|
||||
if (nextNode == 0)
|
||||
break;
|
||||
currentNode = nextNode;
|
||||
currentIndexPlus1++;
|
||||
}
|
||||
|
||||
fCurrentNode = currentNode;
|
||||
fCurrentIndexPlus1 = currentIndexPlus1;
|
||||
|
||||
// If we found a node at the requested index, make that the current node
|
||||
if (nextNode != 0)
|
||||
{
|
||||
return currentNode;
|
||||
}
|
||||
|
||||
// If we didn't find a node at the requested index, return 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Iterative tree-walker. When you have a Parent link, there's often no
|
||||
need to resort to recursion. NOTE THAT only Element nodes are matched
|
||||
since we're specifically supporting getElementsByTagName().
|
||||
*/
|
||||
DOMNode *DOMDeepNodeListImpl::nextMatchingElementAfter(DOMNode *current)
|
||||
{
|
||||
DOMNode *next;
|
||||
while (current != 0)
|
||||
{
|
||||
// Look down to first child.
|
||||
if (current->hasChildNodes())
|
||||
{
|
||||
current = current->getFirstChild();
|
||||
}
|
||||
// Look right to sibling (but not from root!)
|
||||
else
|
||||
{
|
||||
if (current != fRootNode && 0 != (next = current->getNextSibling()))
|
||||
{
|
||||
current = next;
|
||||
}
|
||||
// Look up and right (but not past root!)
|
||||
else
|
||||
{
|
||||
next = 0;
|
||||
for (;
|
||||
current != fRootNode; // Stop on return to starting point
|
||||
current = current->getParentNode())
|
||||
{
|
||||
next = current->getNextSibling();
|
||||
if (next != 0)
|
||||
break;
|
||||
}
|
||||
current = next;
|
||||
}
|
||||
}
|
||||
|
||||
// Have we found an Element with the right tagName?
|
||||
// ("*" matches anything.)
|
||||
if (current != 0 && current != fRootNode &&
|
||||
current->getNodeType() == DOMNode::ELEMENT_NODE) {
|
||||
DOMElement *currElement = (DOMElement *)current;
|
||||
|
||||
if (!fMatchURIandTagname) { //DOM Level 1
|
||||
if (fMatchAll ||
|
||||
XMLString::equals(currElement->getTagName(), fTagName))
|
||||
return current;
|
||||
} else { //DOM Level 2
|
||||
if (!fMatchAllURI &&
|
||||
!XMLString::equals(current->getNamespaceURI(), fNamespaceURI))
|
||||
continue;
|
||||
|
||||
if (fMatchAll ||
|
||||
XMLString::equals(current->getLocalName(), fTagName))
|
||||
return current;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise continue walking the tree
|
||||
}
|
||||
// Fell out of tree-walk; no more instances found
|
||||
return 0;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMDeepNodeListImpl.hpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMDEEPNODELISTIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMDEEPNODELISTIMPL_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMNodeList.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMNode;
|
||||
|
||||
|
||||
class CDOM_EXPORT DOMDeepNodeListImpl: public DOMNodeList {
|
||||
protected:
|
||||
const DOMNode* fRootNode;
|
||||
const XMLCh* fTagName;
|
||||
bool fMatchAll;
|
||||
int fChanges;
|
||||
DOMNode* fCurrentNode;
|
||||
XMLSize_t fCurrentIndexPlus1;
|
||||
|
||||
//DOM Level 2
|
||||
const XMLCh* fNamespaceURI;
|
||||
bool fMatchAllURI;
|
||||
bool fMatchURIandTagname; //match both namespaceURI and tagName
|
||||
|
||||
public:
|
||||
DOMDeepNodeListImpl(const DOMNode *rootNode, const XMLCh *tagName);
|
||||
DOMDeepNodeListImpl(const DOMNode *rootNode, //DOM Level 2
|
||||
const XMLCh *namespaceURI,
|
||||
const XMLCh *localName);
|
||||
virtual ~DOMDeepNodeListImpl();
|
||||
virtual XMLSize_t getLength() const;
|
||||
virtual DOMNode* item(XMLSize_t index) const;
|
||||
DOMNode* cacheItem(XMLSize_t index);
|
||||
|
||||
protected:
|
||||
DOMNode* nextMatchingElementAfter(DOMNode *current);
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMDeepNodeListImpl(const DOMDeepNodeListImpl &);
|
||||
DOMDeepNodeListImpl & operator = (const DOMDeepNodeListImpl &);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,428 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* $Id: DOMDeepNodeListPool.c 883368 2009-11-23 15:28:19Z amassari $
|
||||
*/
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Include
|
||||
// ---------------------------------------------------------------------------
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#if defined(XERCES_TMPLSINC)
|
||||
#include <xercesc/dom/impl/DOMDeepNodeListPool.hpp>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// DOMDeepNodeListPool: Constructors and Destructor
|
||||
// ---------------------------------------------------------------------------
|
||||
template <class TVal, class THasher>
|
||||
DOMDeepNodeListPool<TVal, THasher>::DOMDeepNodeListPool( const XMLSize_t modulus
|
||||
, const bool adoptElems
|
||||
, const XMLSize_t initSize) :
|
||||
fAdoptedElems(adoptElems)
|
||||
, fBucketList(0)
|
||||
, fHashModulus(modulus)
|
||||
, fIdPtrs(0)
|
||||
, fIdPtrsCount(initSize)
|
||||
, fIdCounter(0)
|
||||
, fMemoryManager(XMLPlatformUtils::fgMemoryManager)
|
||||
{
|
||||
initialize(modulus);
|
||||
|
||||
//
|
||||
// Allocate the initial id pointers array. We don't have to zero them
|
||||
// out since the fIdCounter value tells us which ones are valid. The
|
||||
// zeroth element is never used (and represents an invalid pool id.)
|
||||
//
|
||||
if (!fIdPtrsCount)
|
||||
fIdPtrsCount = 256;
|
||||
|
||||
fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*));//new TVal*[fIdPtrsCount];
|
||||
fIdPtrs[0] = 0;
|
||||
}
|
||||
|
||||
template <class TVal, class THasher>
|
||||
DOMDeepNodeListPool<TVal, THasher>::DOMDeepNodeListPool( const XMLSize_t modulus
|
||||
, const bool adoptElems
|
||||
, const THasher& hasher
|
||||
, const XMLSize_t initSize) :
|
||||
fAdoptedElems(adoptElems)
|
||||
, fBucketList(0)
|
||||
, fHashModulus(modulus)
|
||||
, fIdPtrs(0)
|
||||
, fIdPtrsCount(initSize)
|
||||
, fIdCounter(0)
|
||||
, fMemoryManager(XMLPlatformUtils::fgMemoryManager)
|
||||
, fHasher(hasher)
|
||||
{
|
||||
initialize(modulus);
|
||||
|
||||
//
|
||||
// Allocate the initial id pointers array. We don't have to zero them
|
||||
// out since the fIdCounter value tells us which ones are valid. The
|
||||
// zeroth element is never used (and represents an invalid pool id.)
|
||||
//
|
||||
if (!fIdPtrsCount)
|
||||
fIdPtrsCount = 256;
|
||||
|
||||
fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*));//new TVal*[fIdPtrsCount];
|
||||
fIdPtrs[0] = 0;
|
||||
}
|
||||
|
||||
template <class TVal, class THasher>
|
||||
DOMDeepNodeListPool<TVal, THasher>::DOMDeepNodeListPool( const XMLSize_t modulus
|
||||
, const XMLSize_t initSize) :
|
||||
fAdoptedElems(true)
|
||||
, fBucketList(0)
|
||||
, fHashModulus(modulus)
|
||||
, fIdPtrs(0)
|
||||
, fIdPtrsCount(initSize)
|
||||
, fIdCounter(0)
|
||||
, fMemoryManager(XMLPlatformUtils::fgMemoryManager)
|
||||
{
|
||||
initialize(modulus);
|
||||
|
||||
//
|
||||
// Allocate the initial id pointers array. We don't have to zero them
|
||||
// out since the fIdCounter value tells us which ones are valid. The
|
||||
// zeroth element is never used (and represents an invalid pool id.)
|
||||
//
|
||||
if (!fIdPtrsCount)
|
||||
fIdPtrsCount = 256;
|
||||
|
||||
fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*));//new TVal*[fIdPtrsCount];
|
||||
fIdPtrs[0] = 0;
|
||||
}
|
||||
|
||||
template <class TVal, class THasher>
|
||||
void DOMDeepNodeListPool<TVal, THasher>::initialize(const XMLSize_t modulus)
|
||||
{
|
||||
if (modulus == 0)
|
||||
ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::HshTbl_ZeroModulus, fMemoryManager);
|
||||
|
||||
// Allocate the bucket list and zero them
|
||||
fBucketList = (DOMDeepNodeListPoolTableBucketElem<TVal>**)
|
||||
fMemoryManager->allocate
|
||||
(
|
||||
fHashModulus * sizeof(DOMDeepNodeListPoolTableBucketElem<TVal>*)
|
||||
);//new DOMDeepNodeListPoolTableBucketElem<TVal>*[fHashModulus];
|
||||
for (XMLSize_t index = 0; index < fHashModulus; index++)
|
||||
fBucketList[index] = 0;
|
||||
}
|
||||
|
||||
template <class TVal, class THasher>
|
||||
DOMDeepNodeListPool<TVal, THasher>::~DOMDeepNodeListPool()
|
||||
{
|
||||
removeAll();
|
||||
|
||||
// Then delete the bucket list & hasher & id pointers list
|
||||
fMemoryManager->deallocate(fIdPtrs);//delete [] fIdPtrs;
|
||||
fMemoryManager->deallocate(fBucketList);//delete [] fBucketList;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// DOMDeepNodeListPool: Element management
|
||||
// ---------------------------------------------------------------------------
|
||||
template <class TVal, class THasher>
|
||||
bool DOMDeepNodeListPool<TVal, THasher>::isEmpty() const
|
||||
{
|
||||
// Just check the bucket list for non-empty elements
|
||||
for (XMLSize_t buckInd = 0; buckInd < fHashModulus; buckInd++)
|
||||
{
|
||||
if (fBucketList[buckInd] != 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class TVal, class THasher>
|
||||
bool DOMDeepNodeListPool<TVal, THasher>::containsKey( const void* const key1
|
||||
, const XMLCh* const key2
|
||||
, const XMLCh* const key3) const
|
||||
{
|
||||
XMLSize_t hashVal;
|
||||
const DOMDeepNodeListPoolTableBucketElem<TVal>* findIt = findBucketElem(key1, key2, key3, hashVal);
|
||||
return (findIt != 0);
|
||||
}
|
||||
|
||||
template <class TVal, class THasher>
|
||||
void DOMDeepNodeListPool<TVal, THasher>::removeAll()
|
||||
{
|
||||
if (fIdCounter == 0) return;
|
||||
|
||||
// Clean up the buckets first
|
||||
for (XMLSize_t buckInd = 0; buckInd < fHashModulus; buckInd++)
|
||||
{
|
||||
// Get the bucket list head for this entry
|
||||
DOMDeepNodeListPoolTableBucketElem<TVal>* curElem = fBucketList[buckInd];
|
||||
DOMDeepNodeListPoolTableBucketElem<TVal>* nextElem;
|
||||
while (curElem)
|
||||
{
|
||||
// Save the next element before we hose this one
|
||||
nextElem = curElem->fNext;
|
||||
|
||||
// If we adopted the data, then delete it too
|
||||
// (Note: the userdata hash table instance has data type of void *.
|
||||
// This will generate compiler warnings here on some platforms, but they
|
||||
// can be ignored since fAdoptedElements is false.
|
||||
if (fAdoptedElems)
|
||||
delete curElem->fData;
|
||||
|
||||
// Then delete the current element and move forward
|
||||
fMemoryManager->deallocate(curElem->fKey2);//delete [] curElem->fKey2;
|
||||
fMemoryManager->deallocate(curElem->fKey3);//delete [] curElem->fKey3;
|
||||
|
||||
delete curElem;
|
||||
curElem = nextElem;
|
||||
}
|
||||
|
||||
// Clean out this entry
|
||||
fBucketList[buckInd] = 0;
|
||||
}
|
||||
|
||||
// Reset the id counter
|
||||
fIdCounter = 0;
|
||||
}
|
||||
|
||||
template <class TVal, class THasher>
|
||||
void DOMDeepNodeListPool<TVal, THasher>::cleanup()
|
||||
{
|
||||
removeAll();
|
||||
|
||||
// Then delete the bucket list & hasher & id pointers list
|
||||
fMemoryManager->deallocate(fIdPtrs);//delete [] fIdPtrs;
|
||||
fMemoryManager->deallocate(fBucketList);//delete [] fBucketList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// DOMDeepNodeListPool: Getters
|
||||
// ---------------------------------------------------------------------------
|
||||
template <class TVal, class THasher>
|
||||
TVal*
|
||||
DOMDeepNodeListPool<TVal, THasher>::getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3)
|
||||
{
|
||||
XMLSize_t hashVal;
|
||||
DOMDeepNodeListPoolTableBucketElem<TVal>* findIt = findBucketElem(key1, key2, key3, hashVal);
|
||||
if (!findIt)
|
||||
return 0;
|
||||
return findIt->fData;
|
||||
}
|
||||
|
||||
template <class TVal, class THasher>
|
||||
const TVal*
|
||||
DOMDeepNodeListPool<TVal, THasher>::getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) const
|
||||
{
|
||||
XMLSize_t hashVal;
|
||||
const DOMDeepNodeListPoolTableBucketElem<TVal>* findIt = findBucketElem(key1, key2, key3, hashVal);
|
||||
if (!findIt)
|
||||
return 0;
|
||||
return findIt->fData;
|
||||
}
|
||||
|
||||
template <class TVal, class THasher>
|
||||
TVal*
|
||||
DOMDeepNodeListPool<TVal, THasher>::getById(const XMLSize_t elemId)
|
||||
{
|
||||
// If its either zero or beyond our current id, its an error
|
||||
if (!elemId || (elemId > fIdCounter))
|
||||
ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Pool_InvalidId, fMemoryManager);
|
||||
|
||||
return fIdPtrs[elemId];
|
||||
}
|
||||
|
||||
template <class TVal, class THasher>
|
||||
const TVal*
|
||||
DOMDeepNodeListPool<TVal, THasher>::getById(const XMLSize_t elemId) const
|
||||
{
|
||||
// If its either zero or beyond our current id, its an error
|
||||
if (!elemId || (elemId > fIdCounter))
|
||||
ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Pool_InvalidId, fMemoryManager);
|
||||
|
||||
return fIdPtrs[elemId];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// DOMDeepNodeListPool: Putters
|
||||
// ---------------------------------------------------------------------------
|
||||
template <class TVal, class THasher>
|
||||
XMLSize_t
|
||||
DOMDeepNodeListPool<TVal, THasher>::put(void* key1, XMLCh* key2, XMLCh* key3, TVal* const valueToAdopt)
|
||||
{
|
||||
// First see if the key exists already
|
||||
XMLSize_t hashVal;
|
||||
DOMDeepNodeListPoolTableBucketElem<TVal>* newBucket = findBucketElem(key1, key2, key3, hashVal);
|
||||
|
||||
//
|
||||
// If so,then update its value. If not, then we need to add it to
|
||||
// the right bucket
|
||||
//
|
||||
if (newBucket)
|
||||
{
|
||||
if (fAdoptedElems)
|
||||
delete newBucket->fData;
|
||||
|
||||
fMemoryManager->deallocate(newBucket->fKey2);//delete[] newBucket->fKey2;
|
||||
fMemoryManager->deallocate(newBucket->fKey3);//delete[] newBucket->fKey3;
|
||||
|
||||
newBucket->fData = valueToAdopt;
|
||||
newBucket->fKey1 = key1;
|
||||
newBucket->fKey2 = XMLString::replicate(key2, fMemoryManager);
|
||||
newBucket->fKey3 = XMLString::replicate(key3, fMemoryManager);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Revisit: the gcc compiler 2.95.x is generating an
|
||||
// internal compiler error message. So we use the default
|
||||
// memory manager for now.
|
||||
#if defined (XML_GCC_VERSION) && (XML_GCC_VERSION < 29600)
|
||||
newBucket = new DOMDeepNodeListPoolTableBucketElem<TVal>
|
||||
(
|
||||
key1
|
||||
, key2
|
||||
, key3
|
||||
, valueToAdopt
|
||||
, fBucketList[hashVal]
|
||||
, fMemoryManager
|
||||
);
|
||||
#else
|
||||
newBucket = new (fMemoryManager) DOMDeepNodeListPoolTableBucketElem<TVal>
|
||||
(
|
||||
key1
|
||||
, key2
|
||||
, key3
|
||||
, valueToAdopt
|
||||
, fBucketList[hashVal]
|
||||
, fMemoryManager
|
||||
);
|
||||
#endif
|
||||
fBucketList[hashVal] = newBucket;
|
||||
}
|
||||
|
||||
//
|
||||
// Give this new one the next available id and add to the pointer list.
|
||||
// Expand the list if that is now required.
|
||||
//
|
||||
if (fIdCounter + 1 == fIdPtrsCount)
|
||||
{
|
||||
// Create a new count 1.5 times larger and allocate a new array
|
||||
XMLSize_t newCount = (XMLSize_t)(fIdPtrsCount * 1.5);
|
||||
TVal** newArray = (TVal**) fMemoryManager->allocate
|
||||
(
|
||||
newCount * sizeof(TVal*)
|
||||
);//new TVal*[newCount];
|
||||
|
||||
// Copy over the old contents to the new array
|
||||
memcpy(newArray, fIdPtrs, fIdPtrsCount * sizeof(TVal*));
|
||||
|
||||
// Ok, toss the old array and store the new data
|
||||
fMemoryManager->deallocate(fIdPtrs); //delete [] fIdPtrs;
|
||||
fIdPtrs = newArray;
|
||||
fIdPtrsCount = newCount;
|
||||
}
|
||||
const XMLSize_t retId = ++fIdCounter;
|
||||
fIdPtrs[retId] = valueToAdopt;
|
||||
|
||||
// Return the id that we gave to this element
|
||||
return retId;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// DOMDeepNodeListPool: Private methods
|
||||
// ---------------------------------------------------------------------------
|
||||
template <class TVal, class THasher>
|
||||
DOMDeepNodeListPoolTableBucketElem<TVal>* DOMDeepNodeListPool<TVal, THasher>::
|
||||
findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal)
|
||||
{
|
||||
// Hash the key
|
||||
hashVal = fHasher.getHashVal(key1, fHashModulus);
|
||||
assert(hashVal < fHashModulus);
|
||||
|
||||
// Search that bucket for the key
|
||||
DOMDeepNodeListPoolTableBucketElem<TVal>* curElem = fBucketList[hashVal];
|
||||
while (curElem)
|
||||
{
|
||||
//key2 and key3 are XMLCh*, compareString takes null pointer vs zero len string the same
|
||||
//but we need them to be treated as different keys in this case
|
||||
if (fHasher.equals(key1, curElem->fKey1) && (XMLString::equals(key2, curElem->fKey2)) && (XMLString::equals(key3, curElem->fKey3))) {
|
||||
if (!key2 || !curElem->fKey2) {
|
||||
if (key2 || curElem->fKey2) {
|
||||
curElem = curElem->fNext;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!key3 || !curElem->fKey3) {
|
||||
if (key3 || curElem->fKey3) {
|
||||
curElem = curElem->fNext;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return curElem;
|
||||
}
|
||||
|
||||
curElem = curElem->fNext;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class TVal, class THasher>
|
||||
const DOMDeepNodeListPoolTableBucketElem<TVal>* DOMDeepNodeListPool<TVal, THasher>::
|
||||
findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal) const
|
||||
{
|
||||
// Hash the key
|
||||
hashVal = fHasher.getHashVal(key1, fHashModulus);
|
||||
assert(hashVal < fHashModulus);
|
||||
|
||||
// Search that bucket for the key
|
||||
const DOMDeepNodeListPoolTableBucketElem<TVal>* curElem = fBucketList[hashVal];
|
||||
while (curElem)
|
||||
{
|
||||
//key2 and key3 are XMLCh*, compareString takes null pointer vs zero len string the same
|
||||
//but we need them to be treated as different keys in this case
|
||||
if (fHasher.equals(key1, curElem->fKey1) && (XMLString::equals(key2, curElem->fKey2)) && (XMLString::equals(key3, curElem->fKey3))) {
|
||||
if (!key2 || !curElem->fKey2) {
|
||||
if (key2 || curElem->fKey2) {
|
||||
curElem = curElem->fNext;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!key3 || !curElem->fKey3) {
|
||||
if (key3 || curElem->fKey3) {
|
||||
curElem = curElem->fNext;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return curElem;
|
||||
}
|
||||
|
||||
curElem = curElem->fNext;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMDeepNodeListPool.hpp 883368 2009-11-23 15:28:19Z amassari $
|
||||
*/
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMDEEPNODELISTPOOL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMDEEPNODELISTPOOL_HPP
|
||||
|
||||
|
||||
#include <xercesc/util/Hashers.hpp>
|
||||
#include <xercesc/util/IllegalArgumentException.hpp>
|
||||
#include <xercesc/util/NoSuchElementException.hpp>
|
||||
#include <xercesc/util/RuntimeException.hpp>
|
||||
#include <xercesc/util/XMLExceptMsgs.hpp>
|
||||
#include <xercesc/util/XMLEnumerator.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
//
|
||||
// This should really be a nested class, but some of the compilers we
|
||||
// have to support cannot deal with that!
|
||||
//
|
||||
template <class TVal>
|
||||
struct DOMDeepNodeListPoolTableBucketElem : public XMemory
|
||||
{
|
||||
DOMDeepNodeListPoolTableBucketElem
|
||||
(
|
||||
void* key1
|
||||
, XMLCh* key2
|
||||
, XMLCh* key3
|
||||
, TVal* const value
|
||||
, DOMDeepNodeListPoolTableBucketElem<TVal>* next
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
) :
|
||||
fData(value)
|
||||
, fNext(next)
|
||||
, fKey1(key1)
|
||||
, fKey2(0)
|
||||
, fKey3(0)
|
||||
{
|
||||
if (key2)
|
||||
fKey2 = XMLString::replicate(key2, manager);
|
||||
|
||||
if (key3)
|
||||
fKey3 = XMLString::replicate(key3, manager);
|
||||
}
|
||||
|
||||
TVal* fData;
|
||||
DOMDeepNodeListPoolTableBucketElem<TVal>* fNext;
|
||||
void* fKey1;
|
||||
XMLCh* fKey2;
|
||||
XMLCh* fKey3;
|
||||
|
||||
~DOMDeepNodeListPoolTableBucketElem() {};
|
||||
};
|
||||
|
||||
|
||||
template <class TVal, class THasher = PtrHasher>
|
||||
class DOMDeepNodeListPool
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
DOMDeepNodeListPool
|
||||
(
|
||||
const XMLSize_t modulus
|
||||
, const XMLSize_t initSize = 128
|
||||
);
|
||||
|
||||
DOMDeepNodeListPool
|
||||
(
|
||||
const XMLSize_t modulus
|
||||
, const bool adoptElems
|
||||
, const XMLSize_t initSize = 128
|
||||
);
|
||||
|
||||
DOMDeepNodeListPool
|
||||
(
|
||||
const XMLSize_t modulus
|
||||
, const bool adoptElems
|
||||
, const THasher& hasher
|
||||
, const XMLSize_t initSize = 128
|
||||
);
|
||||
|
||||
~DOMDeepNodeListPool();
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Element management
|
||||
// -----------------------------------------------------------------------
|
||||
bool isEmpty() const;
|
||||
bool containsKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) const;
|
||||
void removeAll();
|
||||
void cleanup();
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getters
|
||||
// -----------------------------------------------------------------------
|
||||
TVal* getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3);
|
||||
const TVal* getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) const;
|
||||
|
||||
TVal* getById(const XMLSize_t elemId);
|
||||
const TVal* getById(const XMLSize_t elemId) const;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Putters
|
||||
// -----------------------------------------------------------------------
|
||||
XMLSize_t put(void* key1, XMLCh* key2, XMLCh* key3, TVal* const valueToAdopt);
|
||||
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private methods
|
||||
// -----------------------------------------------------------------------
|
||||
DOMDeepNodeListPoolTableBucketElem<TVal>* findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal);
|
||||
const DOMDeepNodeListPoolTableBucketElem<TVal>* findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal) const;
|
||||
void initialize(const XMLSize_t modulus);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMDeepNodeListPool(const DOMDeepNodeListPool<TVal, THasher> &);
|
||||
DOMDeepNodeListPool<TVal, THasher> & operator = (const DOMDeepNodeListPool<TVal, THasher> &);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Data members
|
||||
//
|
||||
// fAdoptedElems
|
||||
// Indicates whether the values added are adopted or just referenced.
|
||||
// If adopted, then they are deleted when they are removed from the
|
||||
// hash table.
|
||||
//
|
||||
// fBucketList
|
||||
// This is the array that contains the heads of all of the list
|
||||
// buckets, one for each possible hash value.
|
||||
//
|
||||
// fHashModulus
|
||||
// The modulus used for this hash table, to hash the keys. This is
|
||||
// also the number of elements in the bucket list.
|
||||
//
|
||||
// fHash
|
||||
// The hasher for the key1 data type.
|
||||
//
|
||||
// fIdPtrs
|
||||
// fIdPtrsCount
|
||||
// This is the array of pointers to the bucket elements in order of
|
||||
// their assigned ids. So taking id N and referencing this array
|
||||
// gives you the element with that id. The count field indicates
|
||||
// the current size of this list. When fIdCounter+1 reaches this
|
||||
// value the list must be expanded.
|
||||
//
|
||||
// fIdCounter
|
||||
// This is used to give out unique ids to added elements. It starts
|
||||
// at zero (which means empty), and is bumped up for each newly added
|
||||
// element. So the first element is 1, the next is 2, etc... This
|
||||
// means that this value is set to the top index of the fIdPtrs array.
|
||||
// -----------------------------------------------------------------------
|
||||
bool fAdoptedElems;
|
||||
DOMDeepNodeListPoolTableBucketElem<TVal>** fBucketList;
|
||||
XMLSize_t fHashModulus;
|
||||
TVal** fIdPtrs;
|
||||
XMLSize_t fIdPtrsCount;
|
||||
XMLSize_t fIdCounter;
|
||||
MemoryManager* fMemoryManager;
|
||||
THasher fHasher;
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#if !defined(XERCES_TMPLSINC)
|
||||
#include <xercesc/dom/impl/DOMDeepNodeListPool.c>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMDocumentFragmentImpl.cpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#include "DOMDocumentFragmentImpl.hpp"
|
||||
#include "DOMDocumentImpl.hpp"
|
||||
#include "DOMCasts.hpp"
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
#include <xercesc/util/XMLUniDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
DOMDocumentFragmentImpl::DOMDocumentFragmentImpl(DOMDocument *masterDoc)
|
||||
: fNode(masterDoc), fParent(masterDoc)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DOMDocumentFragmentImpl::DOMDocumentFragmentImpl(const DOMDocumentFragmentImpl &other,
|
||||
bool deep)
|
||||
: fNode(other.fNode), fParent(other.fParent)
|
||||
{
|
||||
if (deep)
|
||||
castToParentImpl(this)->cloneChildren(&other);
|
||||
}
|
||||
|
||||
|
||||
DOMDocumentFragmentImpl::~DOMDocumentFragmentImpl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
DOMNode *DOMDocumentFragmentImpl::cloneNode(bool deep) const
|
||||
{
|
||||
DOMNode* newNode = new (castToNodeImpl(this)->getOwnerDocument(), DOMMemoryManager::DOCUMENT_FRAGMENT_OBJECT) DOMDocumentFragmentImpl(*this, deep);
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
|
||||
return newNode;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMDocumentFragmentImpl::getNodeName() const {
|
||||
static const XMLCh name[] = {chPound, chLatin_d, chLatin_o, chLatin_c, chLatin_u, chLatin_m,
|
||||
chLatin_e, chLatin_n, chLatin_t, chDash,
|
||||
chLatin_f, chLatin_r, chLatin_a, chLatin_g, chLatin_m, chLatin_e, chLatin_n, chLatin_t, 0};
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
DOMNode::NodeType DOMDocumentFragmentImpl::getNodeType() const {
|
||||
return DOMNode::DOCUMENT_FRAGMENT_NODE;
|
||||
}
|
||||
|
||||
|
||||
void DOMDocumentFragmentImpl::setNodeValue(const XMLCh *x)
|
||||
{
|
||||
fNode.setNodeValue(x);
|
||||
}
|
||||
|
||||
|
||||
void DOMDocumentFragmentImpl::release()
|
||||
{
|
||||
if (fNode.isOwned() && !fNode.isToBeReleased())
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
|
||||
if (doc) {
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
|
||||
fParent.release();
|
||||
doc->release(this, DOMMemoryManager::DOCUMENT_FRAGMENT_OBJECT);
|
||||
}
|
||||
else {
|
||||
// shouldn't reach here
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Delegation stubs for inherited functions.
|
||||
//
|
||||
DOMNode* DOMDocumentFragmentImpl::appendChild(DOMNode *newChild) {return fParent.appendChild (newChild); }
|
||||
DOMNamedNodeMap* DOMDocumentFragmentImpl::getAttributes() const {return fNode.getAttributes (); }
|
||||
DOMNodeList* DOMDocumentFragmentImpl::getChildNodes() const {return fParent.getChildNodes (); }
|
||||
DOMNode* DOMDocumentFragmentImpl::getFirstChild() const {return fParent.getFirstChild (); }
|
||||
DOMNode* DOMDocumentFragmentImpl::getLastChild() const {return fParent.getLastChild (); }
|
||||
const XMLCh* DOMDocumentFragmentImpl::getLocalName() const {return fNode.getLocalName (); }
|
||||
const XMLCh* DOMDocumentFragmentImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); }
|
||||
DOMNode* DOMDocumentFragmentImpl::getNextSibling() const {return fNode.getNextSibling (); }
|
||||
const XMLCh* DOMDocumentFragmentImpl::getNodeValue() const {return fNode.getNodeValue (); }
|
||||
DOMDocument* DOMDocumentFragmentImpl::getOwnerDocument() const {return fParent.fOwnerDocument; }
|
||||
const XMLCh* DOMDocumentFragmentImpl::getPrefix() const {return fNode.getPrefix (); }
|
||||
DOMNode* DOMDocumentFragmentImpl::getParentNode() const {return fNode.getParentNode (); }
|
||||
DOMNode* DOMDocumentFragmentImpl::getPreviousSibling() const {return fNode.getPreviousSibling (); }
|
||||
bool DOMDocumentFragmentImpl::hasChildNodes() const {return fParent.hasChildNodes (); }
|
||||
DOMNode* DOMDocumentFragmentImpl::insertBefore(DOMNode *newChild, DOMNode *refChild)
|
||||
{return fParent.insertBefore (newChild, refChild); }
|
||||
void DOMDocumentFragmentImpl::normalize() {fParent.normalize (); }
|
||||
DOMNode* DOMDocumentFragmentImpl::removeChild(DOMNode *oldChild) {return fParent.removeChild (oldChild); }
|
||||
DOMNode* DOMDocumentFragmentImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild)
|
||||
{return fParent.replaceChild (newChild, oldChild); }
|
||||
bool DOMDocumentFragmentImpl::isSupported(const XMLCh *feature, const XMLCh *version) const
|
||||
{return fNode.isSupported (feature, version); }
|
||||
void DOMDocumentFragmentImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); }
|
||||
bool DOMDocumentFragmentImpl::hasAttributes() const {return fNode.hasAttributes(); }
|
||||
bool DOMDocumentFragmentImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); }
|
||||
bool DOMDocumentFragmentImpl::isEqualNode(const DOMNode* arg) const {return fParent.isEqualNode(arg); }
|
||||
void* DOMDocumentFragmentImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler)
|
||||
{return fNode.setUserData(key, data, handler); }
|
||||
void* DOMDocumentFragmentImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); }
|
||||
const XMLCh* DOMDocumentFragmentImpl::getBaseURI() const {return fNode.getBaseURI(); }
|
||||
short DOMDocumentFragmentImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); }
|
||||
const XMLCh* DOMDocumentFragmentImpl::getTextContent() const {return fNode.getTextContent(); }
|
||||
void DOMDocumentFragmentImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); }
|
||||
const XMLCh* DOMDocumentFragmentImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); }
|
||||
bool DOMDocumentFragmentImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); }
|
||||
const XMLCh* DOMDocumentFragmentImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); }
|
||||
void* DOMDocumentFragmentImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); }
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMDocumentFragmentImpl.hpp 641193 2008-03-26 08:06:57Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTFRAGMENTIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTFRAGMENTIMPL_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMDocumentFragment.hpp>
|
||||
#include "DOMParentNode.hpp"
|
||||
#include "DOMNodeImpl.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class CDOM_EXPORT DOMDocumentFragmentImpl: public DOMDocumentFragment {
|
||||
protected:
|
||||
DOMNodeImpl fNode;
|
||||
DOMParentNode fParent;
|
||||
|
||||
protected:
|
||||
DOMDocumentFragmentImpl(DOMDocument *);
|
||||
DOMDocumentFragmentImpl(const DOMDocumentFragmentImpl &other, bool deep);
|
||||
friend class DOMDocumentImpl;
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMDocumentFragmentImpl & operator = (const DOMDocumentFragmentImpl &);
|
||||
|
||||
public:
|
||||
virtual ~DOMDocumentFragmentImpl();
|
||||
|
||||
public:
|
||||
// Declare all of the functions from DOMNode.
|
||||
DOMNODE_FUNCTIONS;
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,507 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMDocumentImpl.hpp 1662888 2015-02-28 02:26:43Z scantor $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTIMPL_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
#include <xercesc/util/RefArrayOf.hpp>
|
||||
#include <xercesc/util/RefStackOf.hpp>
|
||||
#include <xercesc/util/RefHash2KeysTableOf.hpp>
|
||||
#include <xercesc/util/StringPool.hpp>
|
||||
#include <xercesc/util/KeyRefPair.hpp>
|
||||
#include <xercesc/util/XMLChar.hpp>
|
||||
#include <xercesc/dom/DOMDocument.hpp>
|
||||
#include <xercesc/dom/DOMUserDataHandler.hpp>
|
||||
#include <xercesc/dom/DOMMemoryManager.hpp>
|
||||
#include "DOMNodeImpl.hpp"
|
||||
#include "DOMStringPool.hpp"
|
||||
#include "DOMParentNode.hpp"
|
||||
#include "DOMDeepNodeListPool.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMAttrImpl;
|
||||
class DOMCDATASectionImpl;
|
||||
class DOMCommentImpl;
|
||||
class DOMConfiguration;
|
||||
class DOMDeepNodeListImpl;
|
||||
class DOMDocumentFragmentImpl;
|
||||
class DOMDocumentTypeImpl;
|
||||
class DOMElementImpl;
|
||||
class DOMEntityImpl;
|
||||
class DOMEntityReferenceImpl;
|
||||
class DOMNotationImpl;
|
||||
class DOMProcessingInstructionImpl;
|
||||
class DOMTextImpl;
|
||||
class DOMNodeIteratorImpl;
|
||||
class DOMNormalizer;
|
||||
class DOMTreeWalkerImpl;
|
||||
class DOMNodeFilter;
|
||||
class DOMNodeFilterImpl;
|
||||
class DOMImplementation;
|
||||
class DOMNodeIDMap;
|
||||
class DOMRangeImpl;
|
||||
class DOMBuffer;
|
||||
class MemoryManager;
|
||||
class XPathNSResolver;
|
||||
class XPathExpression;
|
||||
|
||||
typedef RefVectorOf<DOMRangeImpl> Ranges;
|
||||
typedef RefVectorOf<DOMNodeIteratorImpl> NodeIterators;
|
||||
typedef KeyRefPair<void, DOMUserDataHandler> DOMUserDataRecord;
|
||||
typedef RefStackOf<DOMNode> DOMNodePtr;
|
||||
|
||||
class CDOM_EXPORT DOMDocumentImpl: public XMemory, public DOMMemoryManager, public DOMDocument {
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// data
|
||||
// -----------------------------------------------------------------------
|
||||
DOMNodeImpl fNode; // Implements common node functionality.
|
||||
DOMParentNode fParent; // Implements common parent node functionality
|
||||
DOMNodeIDMap* fNodeIDMap; // for use by GetElementsById().
|
||||
|
||||
public:
|
||||
DOMDocumentImpl(DOMImplementation* domImpl, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
DOMDocumentImpl(const XMLCh* namespaceURI, //DOM Level 2
|
||||
const XMLCh* qualifiedName,
|
||||
DOMDocumentType* doctype,
|
||||
DOMImplementation* domImpl,
|
||||
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
virtual ~DOMDocumentImpl();
|
||||
|
||||
void setDocumentType(DOMDocumentType *doctype);
|
||||
|
||||
public:
|
||||
// Add all functions that are pure virtual in DOMNODE
|
||||
DOMNODE_FUNCTIONS;
|
||||
|
||||
public:
|
||||
// Add all functions that are pure virtual in DOMDocument
|
||||
virtual DOMAttr* createAttribute(const XMLCh *name);
|
||||
virtual DOMCDATASection* createCDATASection(const XMLCh *data);
|
||||
virtual DOMComment* createComment(const XMLCh *data);
|
||||
virtual DOMDocumentFragment* createDocumentFragment();
|
||||
virtual DOMDocumentType* createDocumentType(const XMLCh *name);
|
||||
virtual DOMDocumentType* createDocumentType(const XMLCh *qName,
|
||||
const XMLCh *publicId,
|
||||
const XMLCh *systemId);
|
||||
virtual DOMElement* createElement(const XMLCh * tagName);
|
||||
virtual DOMElement* createElementNoCheck(const XMLCh *tagName);
|
||||
virtual DOMEntity* createEntity(const XMLCh * name);
|
||||
virtual DOMEntityReference* createEntityReference(const XMLCh * name);
|
||||
virtual DOMNotation* createNotation(const XMLCh * name);
|
||||
virtual DOMProcessingInstruction* createProcessingInstruction(const XMLCh * target, const XMLCh * data);
|
||||
virtual DOMText* createTextNode(const XMLCh * data);
|
||||
virtual DOMDocumentType* getDoctype() const;
|
||||
virtual DOMElement* getDocumentElement() const;
|
||||
virtual DOMNodeList* getElementsByTagName(const XMLCh * tagname) const;
|
||||
virtual DOMImplementation* getImplementation() const;
|
||||
bool isXMLName(const XMLCh * s);
|
||||
virtual DOMNodeIterator* createNodeIterator(DOMNode *root,
|
||||
DOMNodeFilter::ShowType whatToShow,
|
||||
DOMNodeFilter* filter,
|
||||
bool entityReferenceExpansion);
|
||||
virtual DOMTreeWalker* createTreeWalker(DOMNode *root,
|
||||
DOMNodeFilter::ShowType whatToShow,
|
||||
DOMNodeFilter* filter,
|
||||
bool entityReferenceExpansion);
|
||||
|
||||
|
||||
virtual DOMRange* createRange();
|
||||
virtual Ranges* getRanges() const; //non-standard api
|
||||
virtual NodeIterators* getNodeIterators() const; //non-standard api
|
||||
virtual void removeRange(DOMRangeImpl* range); //non-standard api
|
||||
virtual void removeNodeIterator(DOMNodeIteratorImpl* nodeIterator); //non-standard api
|
||||
|
||||
virtual DOMXPathExpression* createExpression(const XMLCh *expression,
|
||||
const DOMXPathNSResolver *resolver);
|
||||
virtual DOMXPathNSResolver* createNSResolver(const DOMNode *nodeResolver);
|
||||
virtual DOMXPathResult* evaluate(const XMLCh *expression,
|
||||
const DOMNode *contextNode,
|
||||
const DOMXPathNSResolver *resolver,
|
||||
DOMXPathResult::ResultType type,
|
||||
DOMXPathResult* result);
|
||||
|
||||
|
||||
// Extension to be called by the Parser
|
||||
DOMEntityReference* createEntityReferenceByParser(const XMLCh * name);
|
||||
|
||||
// Add all functions that are pure virtual in DOMMemoryManager
|
||||
virtual XMLSize_t getMemoryAllocationBlockSize() const;
|
||||
virtual void setMemoryAllocationBlockSize(XMLSize_t size);
|
||||
virtual void* allocate(XMLSize_t amount);
|
||||
virtual void* allocate(XMLSize_t amount, DOMMemoryManager::NodeObjectType type);
|
||||
virtual void release(DOMNode* object, DOMMemoryManager::NodeObjectType type);
|
||||
virtual XMLCh* cloneString(const XMLCh *src);
|
||||
|
||||
//
|
||||
// Functions to keep track of document mutations, so that node list chached
|
||||
// information can be invalidated. One global changes counter per document.
|
||||
//
|
||||
virtual void changed();
|
||||
virtual int changes() const;
|
||||
|
||||
/**
|
||||
* Sets whether the DOM implementation performs error checking
|
||||
* upon operations. Turning off error checking only affects
|
||||
* the following DOM checks:
|
||||
* <ul>
|
||||
* <li>Checking strings to make sure that all characters are
|
||||
* legal XML characters
|
||||
* <li>Hierarchy checking such as allowed children, checks for
|
||||
* cycles, etc.
|
||||
* </ul>
|
||||
* <p>
|
||||
* Turning off error checking does <em>not</em> turn off the
|
||||
* following checks:
|
||||
* <ul>
|
||||
* <li>Read only checks
|
||||
* <li>Checks related to DOM events
|
||||
* </ul>
|
||||
*/
|
||||
inline void setErrorChecking(bool check) {
|
||||
errorChecking = check;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the DOM implementation performs error checking.
|
||||
*/
|
||||
inline bool getErrorChecking() const {
|
||||
return errorChecking;
|
||||
}
|
||||
|
||||
//Introduced in DOM Level 2
|
||||
virtual DOMNode* importNode(const DOMNode *source, bool deep);
|
||||
virtual DOMElement* createElementNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *qualifiedName);
|
||||
virtual DOMElement* createElementNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *qualifiedName,
|
||||
const XMLFileLoc lineNo,
|
||||
const XMLFileLoc columnNo);
|
||||
virtual DOMAttr* createAttributeNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *qualifiedName);
|
||||
virtual DOMNodeList* getElementsByTagNameNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const;
|
||||
virtual DOMElement* getElementById(const XMLCh *elementId) const;
|
||||
|
||||
//Introduced in DOM Level 3
|
||||
virtual const XMLCh* getInputEncoding() const;
|
||||
virtual const XMLCh* getXmlEncoding() const;
|
||||
virtual bool getXmlStandalone() const;
|
||||
virtual void setXmlStandalone(bool standalone);
|
||||
virtual const XMLCh* getXmlVersion() const;
|
||||
virtual void setXmlVersion(const XMLCh* version);
|
||||
virtual const XMLCh* getDocumentURI() const;
|
||||
virtual void setDocumentURI(const XMLCh* documentURI);
|
||||
virtual bool getStrictErrorChecking() const;
|
||||
virtual void setStrictErrorChecking(bool strictErrorChecking);
|
||||
virtual DOMNode* adoptNode(DOMNode* source);
|
||||
virtual void normalizeDocument();
|
||||
virtual DOMConfiguration* getDOMConfig() const;
|
||||
|
||||
void setInputEncoding(const XMLCh* actualEncoding);
|
||||
void setXmlEncoding(const XMLCh* encoding);
|
||||
// helper functions to prevent storing userdata pointers on every node.
|
||||
void* setUserData(DOMNodeImpl* n,
|
||||
const XMLCh* key,
|
||||
void* data,
|
||||
DOMUserDataHandler* handler);
|
||||
void* getUserData(const DOMNodeImpl* n,
|
||||
const XMLCh* key) const;
|
||||
void callUserDataHandlers(const DOMNodeImpl* n,
|
||||
DOMUserDataHandler::DOMOperationType operation,
|
||||
const DOMNode* src,
|
||||
DOMNode* dst) const;
|
||||
void transferUserData(DOMNodeImpl* n1, DOMNodeImpl* n2);
|
||||
|
||||
DOMNode* renameNode(DOMNode* n,
|
||||
const XMLCh* namespaceURI,
|
||||
const XMLCh* name);
|
||||
|
||||
//Return the index > 0 of ':' in the given qualified name qName="prefix:localName".
|
||||
//Return 0 if there is no ':', or -1 if qName is malformed such as ":abcd".
|
||||
static int indexofQualifiedName(const XMLCh * qName);
|
||||
static bool isKidOK(DOMNode *parent, DOMNode *child);
|
||||
|
||||
inline DOMNodeIDMap* getNodeIDMap() {return fNodeIDMap;};
|
||||
|
||||
|
||||
//
|
||||
// Memory Management Functions. All memory is allocated by and owned by
|
||||
// a document, and is not recovered until the
|
||||
// document itself is deleted.
|
||||
//
|
||||
const XMLCh* getPooledString(const XMLCh*);
|
||||
const XMLCh* getPooledNString(const XMLCh*, XMLSize_t);
|
||||
void deleteHeap();
|
||||
void releaseDocNotifyUserData(DOMNode* object);
|
||||
void releaseBuffer(DOMBuffer* buffer);
|
||||
DOMBuffer* popBuffer(XMLSize_t nMinSize);
|
||||
MemoryManager* getMemoryManager() const;
|
||||
|
||||
// Factory methods for getting/creating node lists.
|
||||
// Because nothing is ever deleted, the implementation caches and recycles
|
||||
// previously used instances of DOMDeepNodeList
|
||||
//
|
||||
DOMNodeList* getDeepNodeList(const DOMNode *rootNode, const XMLCh *tagName);
|
||||
DOMNodeList* getDeepNodeList(const DOMNode *rootNode, //DOM Level 2
|
||||
const XMLCh *namespaceURI,
|
||||
const XMLCh *localName);
|
||||
|
||||
protected:
|
||||
//Internal helper functions
|
||||
virtual DOMNode* importNode(const DOMNode *source, bool deep, bool cloningNode);
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMDocumentImpl(const DOMDocumentImpl &);
|
||||
DOMDocumentImpl & operator = (const DOMDocumentImpl &);
|
||||
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// data
|
||||
// -----------------------------------------------------------------------
|
||||
// New data introduced in DOM Level 3
|
||||
const XMLCh* fInputEncoding;
|
||||
const XMLCh* fXmlEncoding;
|
||||
bool fXmlStandalone;
|
||||
const XMLCh* fXmlVersion;
|
||||
const XMLCh* fDocumentURI;
|
||||
DOMConfiguration* fDOMConfiguration;
|
||||
|
||||
XMLStringPool fUserDataTableKeys;
|
||||
RefHash2KeysTableOf<DOMUserDataRecord, PtrHasher>* fUserDataTable;
|
||||
|
||||
|
||||
// Per-Document heap Variables.
|
||||
// The heap consists of one or more biggish blocks which are
|
||||
// sub-allocated for individual allocations of nodes, strings, etc.
|
||||
// The big blocks form a linked list, allowing them to be located for deletion.
|
||||
//
|
||||
// There is no provision for deleting suballocated blocks, other than
|
||||
// deleting the entire heap when the document is deleted.
|
||||
//
|
||||
// There is no header on individual sub-allocated blocks.
|
||||
// The header on big blocks consists only of a single back pointer to
|
||||
// the previously allocated big block (our linked list of big blocks)
|
||||
//
|
||||
//
|
||||
// revisit - this heap should be encapsulated into its own
|
||||
// class, rather than hanging naked on Document.
|
||||
//
|
||||
void* fCurrentBlock;
|
||||
char* fFreePtr;
|
||||
XMLSize_t fFreeBytesRemaining,
|
||||
fHeapAllocSize;
|
||||
|
||||
// To recycle the DOMNode pointer
|
||||
RefArrayOf<DOMNodePtr>* fRecycleNodePtr;
|
||||
|
||||
// To recycle DOMBuffer pointer
|
||||
RefStackOf<DOMBuffer>* fRecycleBufferPtr;
|
||||
|
||||
// Pool of DOMNodeList for getElementsByTagName
|
||||
DOMDeepNodeListPool<DOMDeepNodeListImpl>* fNodeListPool;
|
||||
|
||||
// Other data
|
||||
DOMDocumentType* fDocType;
|
||||
DOMElement* fDocElement;
|
||||
|
||||
DOMStringPoolEntry** fNameTable;
|
||||
XMLSize_t fNameTableSize;
|
||||
|
||||
DOMNormalizer* fNormalizer;
|
||||
Ranges* fRanges;
|
||||
NodeIterators* fNodeIterators;
|
||||
MemoryManager* fMemoryManager; // configurable memory manager
|
||||
DOMImplementation* fDOMImplementation;
|
||||
|
||||
int fChanges;
|
||||
bool errorChecking; // Bypass error checking.
|
||||
|
||||
};
|
||||
|
||||
inline MemoryManager* DOMDocumentImpl::getMemoryManager() const
|
||||
{
|
||||
return fMemoryManager;
|
||||
}
|
||||
|
||||
inline const XMLCh* DOMDocumentImpl::getPooledString(const XMLCh *in)
|
||||
{
|
||||
if (in == 0)
|
||||
return 0;
|
||||
|
||||
DOMStringPoolEntry **pspe;
|
||||
DOMStringPoolEntry *spe;
|
||||
|
||||
XMLSize_t inHash = XMLString::hash(in, fNameTableSize);
|
||||
pspe = &fNameTable[inHash];
|
||||
while (*pspe != 0)
|
||||
{
|
||||
if (XMLString::equals((*pspe)->fString, in))
|
||||
return (*pspe)->fString;
|
||||
pspe = &((*pspe)->fNext);
|
||||
}
|
||||
|
||||
// This string hasn't been seen before. Add it to the pool.
|
||||
//
|
||||
|
||||
// Compute size to allocate. Note that there's 1 char of string
|
||||
// declared in the struct, so we don't need to add one again to
|
||||
// account for the trailing null.
|
||||
//
|
||||
XMLSize_t n = XMLString::stringLen(in);
|
||||
XMLSize_t sizeToAllocate = sizeof(DOMStringPoolEntry) + n*sizeof(XMLCh);
|
||||
*pspe = spe = (DOMStringPoolEntry *)allocate(sizeToAllocate);
|
||||
spe->fNext = 0;
|
||||
XMLString::copyString((XMLCh*)spe->fString, in);
|
||||
|
||||
return spe->fString;
|
||||
}
|
||||
|
||||
inline const XMLCh* DOMDocumentImpl::getPooledNString(const XMLCh *in, XMLSize_t n)
|
||||
{
|
||||
if (in == 0)
|
||||
return 0;
|
||||
|
||||
DOMStringPoolEntry **pspe;
|
||||
DOMStringPoolEntry *spe;
|
||||
|
||||
XMLSize_t inHash = XMLString::hashN(in, n, fNameTableSize);
|
||||
pspe = &fNameTable[inHash];
|
||||
while (*pspe != 0)
|
||||
{
|
||||
if (XMLString::stringLen((*pspe)->fString) == n && XMLString::equalsN((*pspe)->fString, in, n))
|
||||
return (*pspe)->fString;
|
||||
pspe = &((*pspe)->fNext);
|
||||
}
|
||||
|
||||
// This string hasn't been seen before. Add it to the pool.
|
||||
//
|
||||
|
||||
// Compute size to allocate. Note that there's 1 char of string
|
||||
// declared in the struct, so we don't need to add one again to
|
||||
// account for the trailing null.
|
||||
//
|
||||
XMLSize_t sizeToAllocate = sizeof(DOMStringPoolEntry) + n*sizeof(XMLCh);
|
||||
*pspe = spe = (DOMStringPoolEntry *)allocate(sizeToAllocate);
|
||||
spe->fNext = 0;
|
||||
XMLString::copyNString((XMLCh*)spe->fString, in, n);
|
||||
|
||||
return spe->fString;
|
||||
}
|
||||
|
||||
inline int DOMDocumentImpl::indexofQualifiedName(const XMLCh* name)
|
||||
{
|
||||
int i = 0;
|
||||
int colon = -1;
|
||||
int colon_count = 0;
|
||||
for (; *name != 0; ++i, ++name)
|
||||
{
|
||||
if (*name == chColon)
|
||||
{
|
||||
++colon_count;
|
||||
colon = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 0 || colon == 0 || colon == (i - 1) || colon_count > 1)
|
||||
return -1;
|
||||
|
||||
return colon != -1 ? colon : 0;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// Operator new. Global overloaded version, lets any object be allocated on
|
||||
// the heap owned by a document.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
inline void * operator new(size_t amt, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentImpl *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager::NodeObjectType type)
|
||||
{
|
||||
void *p = doc->allocate(amt, type);
|
||||
return p;
|
||||
}
|
||||
|
||||
inline void * operator new(size_t amt, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager::NodeObjectType type)
|
||||
{
|
||||
XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager* mgr=(XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager*)doc->getFeature(XERCES_CPP_NAMESPACE_QUALIFIER XMLUni::fgXercescInterfaceDOMMemoryManager,0);
|
||||
void* p=0;
|
||||
if(mgr)
|
||||
p = mgr->allocate(amt, type);
|
||||
return p;
|
||||
}
|
||||
|
||||
inline void * operator new(size_t amt, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentImpl *doc)
|
||||
{
|
||||
void* p = doc->allocate(amt);
|
||||
return p;
|
||||
}
|
||||
|
||||
inline void * operator new(size_t amt, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc)
|
||||
{
|
||||
XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager* mgr=(XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager*)doc->getFeature(XERCES_CPP_NAMESPACE_QUALIFIER XMLUni::fgXercescInterfaceDOMMemoryManager,0);
|
||||
void* p=0;
|
||||
if(mgr)
|
||||
p = mgr->allocate(amt);
|
||||
return p;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// For DOM:
|
||||
// Bypass compiler warning:
|
||||
// no matching operator delete found; memory will not be freed if initialization throws an exception
|
||||
// ---------------------------------------------------------------------------
|
||||
#if !defined(XERCES_NO_MATCHING_DELETE_OPERATOR)
|
||||
inline void operator delete(void* /*ptr*/, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentImpl * /*doc*/, XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager::NodeObjectType /*type*/)
|
||||
{
|
||||
return;
|
||||
}
|
||||
inline void operator delete(void* /*ptr*/, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * /*doc*/, XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager::NodeObjectType /*type*/)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
inline void operator delete(void* /*ptr*/, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentImpl * /*doc*/)
|
||||
{
|
||||
return;
|
||||
}
|
||||
inline void operator delete(void* /*ptr*/, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * /*doc*/)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,555 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMDocumentTypeImpl.cpp 678709 2008-07-22 10:56:56Z borisk $
|
||||
*/
|
||||
|
||||
#include "DOMDocumentTypeImpl.hpp"
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
#include <xercesc/dom/DOMImplementationRegistry.hpp>
|
||||
#include <xercesc/dom/DOMImplementation.hpp>
|
||||
#include <xercesc/util/XMLUniDefs.hpp>
|
||||
#include <xercesc/util/XMLChar.hpp>
|
||||
#include <xercesc/util/Mutexes.hpp>
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/util/XMLInitializer.hpp>
|
||||
|
||||
#include "DOMNamedNodeMapImpl.hpp"
|
||||
#include "DOMDocumentImpl.hpp"
|
||||
#include "DOMCasts.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
static DOMDocument* sDocument = 0;
|
||||
static XMLMutex* sDocumentMutex = 0;
|
||||
|
||||
void XMLInitializer::initializeDOMDocumentTypeImpl()
|
||||
{
|
||||
sDocumentMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
static const XMLCh gCoreStr[] = { chLatin_C, chLatin_o, chLatin_r, chLatin_e, chNull };
|
||||
DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(gCoreStr);
|
||||
sDocument = impl->createDocument(); // document type object (DTD).
|
||||
}
|
||||
|
||||
void XMLInitializer::terminateDOMDocumentTypeImpl()
|
||||
{
|
||||
sDocument->release();
|
||||
sDocument = 0;
|
||||
|
||||
delete sDocumentMutex;
|
||||
sDocumentMutex = 0;
|
||||
}
|
||||
|
||||
DOMDocumentTypeImpl::DOMDocumentTypeImpl(DOMDocument *ownerDoc,
|
||||
const XMLCh *dtName,
|
||||
bool heap)
|
||||
: fNode(ownerDoc),
|
||||
fParent(ownerDoc),
|
||||
fName(0),
|
||||
fEntities(0),
|
||||
fNotations(0),
|
||||
fElements(0),
|
||||
fPublicId(0),
|
||||
fSystemId(0),
|
||||
fInternalSubset(0),
|
||||
fIntSubsetReading(false),
|
||||
fIsCreatedFromHeap(heap)
|
||||
{
|
||||
if (ownerDoc)
|
||||
{
|
||||
fName = ((DOMDocumentImpl *)ownerDoc)->getPooledString(dtName);
|
||||
fEntities = new (ownerDoc) DOMNamedNodeMapImpl(this);
|
||||
fNotations= new (ownerDoc) DOMNamedNodeMapImpl(this);
|
||||
fElements = new (ownerDoc) DOMNamedNodeMapImpl(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
XMLMutexLock lock(sDocumentMutex);
|
||||
DOMDocument* doc = sDocument;
|
||||
fName = ((DOMDocumentImpl *)doc)->getPooledString(dtName);
|
||||
fEntities = new (doc) DOMNamedNodeMapImpl(this);
|
||||
fNotations= new (doc) DOMNamedNodeMapImpl(this);
|
||||
fElements = new (doc) DOMNamedNodeMapImpl(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Introduced in DOM Level 2
|
||||
DOMDocumentTypeImpl::DOMDocumentTypeImpl(DOMDocument *ownerDoc,
|
||||
const XMLCh *qualifiedName,
|
||||
const XMLCh *pubId,
|
||||
const XMLCh *sysId,
|
||||
bool heap)
|
||||
: fNode(ownerDoc),
|
||||
fParent(ownerDoc),
|
||||
fName(0),
|
||||
fEntities(0),
|
||||
fNotations(0),
|
||||
fElements(0),
|
||||
fPublicId(0),
|
||||
fSystemId(0),
|
||||
fInternalSubset(0),
|
||||
fIntSubsetReading(false),
|
||||
fIsCreatedFromHeap(heap)
|
||||
{
|
||||
int index = DOMDocumentImpl::indexofQualifiedName(qualifiedName);
|
||||
if (index < 0)
|
||||
throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
else if (index > 0)
|
||||
{
|
||||
// we have to make sure the qualifiedName has correct prefix and localName
|
||||
// although we don't really to store them separately
|
||||
XMLCh* newName;
|
||||
XMLCh temp[256];
|
||||
if (index >= 255)
|
||||
newName = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate
|
||||
(
|
||||
(XMLString::stringLen(qualifiedName)+1) * sizeof(XMLCh)
|
||||
);//new XMLCh[XMLString::stringLen(qualifiedName)+1];
|
||||
else
|
||||
newName = temp;
|
||||
|
||||
XMLString::copyNString(newName, qualifiedName, index);
|
||||
newName[index] = chNull;
|
||||
|
||||
// Before we carry on, we should check if the prefix or localName are valid XMLName
|
||||
if (ownerDoc) {
|
||||
if (!((DOMDocumentImpl*)ownerDoc)->isXMLName(newName) || !((DOMDocumentImpl*)ownerDoc)->isXMLName(qualifiedName+index+1))
|
||||
throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
else {
|
||||
// document is not there yet, so assume XML 1.0
|
||||
if (!XMLChar1_0::isValidName(newName) || !XMLChar1_0::isValidName(qualifiedName+index+1))
|
||||
throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
|
||||
if (index >= 255)
|
||||
XMLPlatformUtils::fgMemoryManager->deallocate(newName);//delete[] newName;
|
||||
}
|
||||
|
||||
if (ownerDoc)
|
||||
{
|
||||
DOMDocumentImpl *docImpl = (DOMDocumentImpl *)ownerDoc;
|
||||
fPublicId = docImpl->cloneString(pubId);
|
||||
fSystemId = docImpl->cloneString(sysId);
|
||||
fName = ((DOMDocumentImpl *)ownerDoc)->getPooledString(qualifiedName);
|
||||
fEntities = new (ownerDoc) DOMNamedNodeMapImpl(this);
|
||||
fNotations= new (ownerDoc) DOMNamedNodeMapImpl(this);
|
||||
fElements = new (ownerDoc) DOMNamedNodeMapImpl(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
XMLMutexLock lock(sDocumentMutex);
|
||||
DOMDocument* doc = sDocument;
|
||||
fPublicId = ((DOMDocumentImpl*) doc)->cloneString(pubId);
|
||||
fSystemId = ((DOMDocumentImpl*) doc)->cloneString(sysId);
|
||||
fName = ((DOMDocumentImpl*) doc)->getPooledString(qualifiedName);
|
||||
fEntities = new (doc) DOMNamedNodeMapImpl(this);
|
||||
fNotations= new (doc) DOMNamedNodeMapImpl(this);
|
||||
fElements = new (doc) DOMNamedNodeMapImpl(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DOMDocumentTypeImpl::DOMDocumentTypeImpl(const DOMDocumentTypeImpl &other, bool heap, bool deep)
|
||||
: fNode(other.fNode),
|
||||
fParent(other.fParent),
|
||||
fChild(other.fChild),
|
||||
fName(0),
|
||||
fEntities(0),
|
||||
fNotations(0),
|
||||
fElements(0),
|
||||
fPublicId(0),
|
||||
fSystemId(0),
|
||||
fInternalSubset(0),
|
||||
fIntSubsetReading(other.fIntSubsetReading),
|
||||
fIsCreatedFromHeap(heap)
|
||||
{
|
||||
fName = other.fName;
|
||||
|
||||
//DOM Level 2
|
||||
fPublicId = other.fPublicId;
|
||||
fSystemId = other.fSystemId;
|
||||
fInternalSubset = other.fInternalSubset;
|
||||
|
||||
if ((DOMDocumentImpl *)this->fNode.getOwnerDocument() && deep)
|
||||
fParent.cloneChildren(&other);
|
||||
|
||||
fEntities = other.fEntities->cloneMap(this);
|
||||
fNotations= other.fNotations->cloneMap(this);
|
||||
fElements = other.fElements->cloneMap(this);
|
||||
}
|
||||
|
||||
|
||||
DOMDocumentTypeImpl::~DOMDocumentTypeImpl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DOMNode *DOMDocumentTypeImpl::cloneNode(bool deep) const
|
||||
{
|
||||
DOMNode* newNode = 0;
|
||||
DOMDocument* doc = castToNodeImpl(this)->getOwnerDocument();
|
||||
if (doc != 0)
|
||||
newNode = new (doc, DOMMemoryManager::DOCUMENT_TYPE_OBJECT) DOMDocumentTypeImpl(*this, false, deep);
|
||||
else
|
||||
{
|
||||
XMLMutexLock lock(sDocumentMutex);
|
||||
newNode = new (sDocument, DOMMemoryManager::DOCUMENT_TYPE_OBJECT) DOMDocumentTypeImpl(*this, false, deep);
|
||||
}
|
||||
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
|
||||
return newNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* NON-DOM
|
||||
* set the ownerDocument of this node and its children
|
||||
*/
|
||||
void DOMDocumentTypeImpl::setOwnerDocument(DOMDocument *doc) {
|
||||
|
||||
if (castToNodeImpl(this)->getOwnerDocument()) {
|
||||
fNode.setOwnerDocument(doc);
|
||||
fParent.setOwnerDocument(doc);
|
||||
}
|
||||
else {
|
||||
if (doc) {
|
||||
DOMDocumentImpl *docImpl = (DOMDocumentImpl *)doc;
|
||||
|
||||
fPublicId = docImpl->cloneString(fPublicId);
|
||||
fSystemId = docImpl->cloneString(fSystemId);
|
||||
fInternalSubset = docImpl->cloneString(fInternalSubset);
|
||||
fName = docImpl->getPooledString(fName);
|
||||
|
||||
fNode.setOwnerDocument(doc);
|
||||
fParent.setOwnerDocument(doc);
|
||||
|
||||
DOMNamedNodeMapImpl* entitiesTemp = fEntities->cloneMap(this);
|
||||
DOMNamedNodeMapImpl* notationsTemp = fNotations->cloneMap(this);
|
||||
DOMNamedNodeMapImpl* elementsTemp = fElements->cloneMap(this);
|
||||
|
||||
fEntities = entitiesTemp;
|
||||
fNotations = notationsTemp;
|
||||
fElements = elementsTemp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const XMLCh * DOMDocumentTypeImpl::getNodeName() const
|
||||
{
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
DOMNode::NodeType DOMDocumentTypeImpl::getNodeType() const {
|
||||
return DOMNode::DOCUMENT_TYPE_NODE;
|
||||
}
|
||||
|
||||
|
||||
DOMNamedNodeMap *DOMDocumentTypeImpl::getEntities() const
|
||||
{
|
||||
return fEntities;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const XMLCh * DOMDocumentTypeImpl::getName() const
|
||||
{
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
DOMNamedNodeMap *DOMDocumentTypeImpl::getNotations() const
|
||||
{
|
||||
return fNotations;
|
||||
}
|
||||
|
||||
|
||||
DOMNamedNodeMap *DOMDocumentTypeImpl::getElements() const
|
||||
{
|
||||
return fElements;
|
||||
}
|
||||
|
||||
|
||||
void DOMDocumentTypeImpl::setNodeValue(const XMLCh *val)
|
||||
{
|
||||
fNode.setNodeValue(val);
|
||||
}
|
||||
|
||||
|
||||
void DOMDocumentTypeImpl::setReadOnly(bool readOnl, bool deep)
|
||||
{
|
||||
fNode.setReadOnly(readOnl,deep);
|
||||
if (fEntities)
|
||||
fEntities->setReadOnly(readOnl,true);
|
||||
if (fNotations)
|
||||
fNotations->setReadOnly(readOnl,true);
|
||||
}
|
||||
|
||||
|
||||
//Introduced in DOM Level 2
|
||||
|
||||
const XMLCh * DOMDocumentTypeImpl::getPublicId() const
|
||||
{
|
||||
return fPublicId;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMDocumentTypeImpl::getSystemId() const
|
||||
{
|
||||
return fSystemId;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMDocumentTypeImpl::getInternalSubset() const
|
||||
{
|
||||
return fInternalSubset;
|
||||
}
|
||||
|
||||
bool DOMDocumentTypeImpl::isIntSubsetReading() const
|
||||
{
|
||||
return fIntSubsetReading;
|
||||
}
|
||||
|
||||
|
||||
//set functions
|
||||
|
||||
void DOMDocumentTypeImpl::setPublicId(const XMLCh *value)
|
||||
{
|
||||
// revist. Why shouldn't 0 be assigned like any other value?
|
||||
if (value == 0)
|
||||
return;
|
||||
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument();
|
||||
if (doc != 0)
|
||||
fPublicId = doc->cloneString(value);
|
||||
else {
|
||||
XMLMutexLock lock(sDocumentMutex);
|
||||
fPublicId = ((DOMDocumentImpl *)sDocument)->cloneString(value);
|
||||
}
|
||||
}
|
||||
|
||||
void DOMDocumentTypeImpl::setSystemId(const XMLCh *value)
|
||||
{
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument();
|
||||
if (doc != 0)
|
||||
fSystemId = doc->cloneString(value);
|
||||
else {
|
||||
XMLMutexLock lock(sDocumentMutex);
|
||||
fSystemId = ((DOMDocumentImpl *)sDocument)->cloneString(value);
|
||||
}
|
||||
}
|
||||
|
||||
void DOMDocumentTypeImpl::setInternalSubset(const XMLCh *value)
|
||||
{
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument();
|
||||
if (doc != 0)
|
||||
fInternalSubset = doc->cloneString(value);
|
||||
else {
|
||||
XMLMutexLock lock(sDocumentMutex);
|
||||
fInternalSubset = ((DOMDocumentImpl *)sDocument)->cloneString(value);
|
||||
}
|
||||
}
|
||||
|
||||
void DOMDocumentTypeImpl::release()
|
||||
{
|
||||
if (fNode.isOwned()) {
|
||||
if (fNode.isToBeReleased()) {
|
||||
// we are calling from documnet.release() which will notify the user data handler
|
||||
if (fIsCreatedFromHeap) {
|
||||
DOMDocumentType* docType = this;
|
||||
delete docType;
|
||||
}
|
||||
}
|
||||
else
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
else {
|
||||
if (fIsCreatedFromHeap) {
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
|
||||
DOMDocumentType* docType = this;
|
||||
delete docType;
|
||||
}
|
||||
else {
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
|
||||
if (doc) {
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
|
||||
doc->release(this, DOMMemoryManager::DOCUMENT_TYPE_OBJECT);
|
||||
}
|
||||
else {
|
||||
// shouldn't reach here
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Delegation for functions inherited from Node
|
||||
//
|
||||
|
||||
DOMNode* DOMDocumentTypeImpl::appendChild(DOMNode *newChild) {return fParent.appendChild (newChild); }
|
||||
DOMNamedNodeMap* DOMDocumentTypeImpl::getAttributes() const {return fNode.getAttributes (); }
|
||||
DOMNodeList* DOMDocumentTypeImpl::getChildNodes() const {return fParent.getChildNodes (); }
|
||||
DOMNode* DOMDocumentTypeImpl::getFirstChild() const {return fParent.getFirstChild (); }
|
||||
DOMNode* DOMDocumentTypeImpl::getLastChild() const {return fParent.getLastChild (); }
|
||||
const XMLCh* DOMDocumentTypeImpl::getLocalName() const {return fNode.getLocalName (); }
|
||||
const XMLCh* DOMDocumentTypeImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); }
|
||||
DOMNode* DOMDocumentTypeImpl::getNextSibling() const {return fChild.getNextSibling (); }
|
||||
const XMLCh* DOMDocumentTypeImpl::getNodeValue() const {return fNode.getNodeValue (); }
|
||||
DOMDocument* DOMDocumentTypeImpl::getOwnerDocument() const {return fParent.fOwnerDocument; }
|
||||
const XMLCh* DOMDocumentTypeImpl::getPrefix() const {return fNode.getPrefix (); }
|
||||
DOMNode* DOMDocumentTypeImpl::getParentNode() const {return fChild.getParentNode (this); }
|
||||
DOMNode* DOMDocumentTypeImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); }
|
||||
bool DOMDocumentTypeImpl::hasChildNodes() const {return fParent.hasChildNodes (); }
|
||||
DOMNode* DOMDocumentTypeImpl::insertBefore(DOMNode *newChild, DOMNode *refChild)
|
||||
{return fParent.insertBefore (newChild, refChild); }
|
||||
void DOMDocumentTypeImpl::normalize() {fParent.normalize (); }
|
||||
DOMNode* DOMDocumentTypeImpl::removeChild(DOMNode *oldChild) {return fParent.removeChild (oldChild); }
|
||||
DOMNode* DOMDocumentTypeImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild)
|
||||
{return fParent.replaceChild (newChild, oldChild); }
|
||||
void DOMDocumentTypeImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); }
|
||||
bool DOMDocumentTypeImpl::hasAttributes() const {return fNode.hasAttributes(); }
|
||||
bool DOMDocumentTypeImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); }
|
||||
void* DOMDocumentTypeImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler)
|
||||
{return fNode.setUserData(key, data, handler); }
|
||||
void* DOMDocumentTypeImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); }
|
||||
const XMLCh* DOMDocumentTypeImpl::getBaseURI() const {return fNode.getBaseURI(); }
|
||||
short DOMDocumentTypeImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); }
|
||||
const XMLCh* DOMDocumentTypeImpl::getTextContent() const {return fNode.getTextContent(); }
|
||||
void DOMDocumentTypeImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); }
|
||||
const XMLCh* DOMDocumentTypeImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); }
|
||||
bool DOMDocumentTypeImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); }
|
||||
const XMLCh* DOMDocumentTypeImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); }
|
||||
|
||||
|
||||
bool DOMDocumentTypeImpl::isEqualNode(const DOMNode* arg) const
|
||||
{
|
||||
if (isSameNode(arg)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!fNode.isEqualNode(arg)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DOMDocumentType* argDT = (DOMDocumentType*) arg;
|
||||
// check the string values
|
||||
if (!getPublicId()) {
|
||||
if (argDT->getPublicId()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!XMLString::equals(getPublicId(), argDT->getPublicId())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getSystemId()) {
|
||||
if (argDT->getSystemId()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!XMLString::equals(getSystemId(), argDT->getSystemId())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getInternalSubset()) {
|
||||
if (argDT->getInternalSubset()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!XMLString::equals(getInternalSubset(), argDT->getInternalSubset())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check the notations
|
||||
if (getNotations()) {
|
||||
if (!argDT->getNotations())
|
||||
return false;
|
||||
|
||||
DOMNamedNodeMap* map1 = getNotations();
|
||||
DOMNamedNodeMap* map2 = argDT->getNotations();
|
||||
|
||||
XMLSize_t len = map1->getLength();
|
||||
if (len != map2->getLength()) {
|
||||
return false;
|
||||
}
|
||||
for (XMLSize_t i = 0; i < len; i++) {
|
||||
DOMNode* n1 = map1->item(i);
|
||||
DOMNode* n2 = map2->getNamedItem(n1->getNodeName());
|
||||
if (!n2 || !n1->isEqualNode(n2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (argDT->getNotations())
|
||||
return false;
|
||||
}
|
||||
|
||||
// check the entities
|
||||
if (getEntities()) {
|
||||
if (!argDT->getEntities())
|
||||
return false;
|
||||
|
||||
DOMNamedNodeMap* map1 = getEntities();
|
||||
DOMNamedNodeMap* map2 = argDT->getEntities();
|
||||
|
||||
XMLSize_t len = map1->getLength();
|
||||
if (len != map2->getLength()) {
|
||||
return false;
|
||||
}
|
||||
for (XMLSize_t i = 0; i < len; i++) {
|
||||
DOMNode* n1 = map1->item(i);
|
||||
DOMNode* n2 = map2->getNamedItem(n1->getNodeName());
|
||||
if (!n2 || !n1->isEqualNode(n2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (argDT->getEntities())
|
||||
return false;
|
||||
}
|
||||
|
||||
return fParent.isEqualNode(arg);
|
||||
}
|
||||
|
||||
bool DOMDocumentTypeImpl::isSupported(const XMLCh *feature, const XMLCh *version) const
|
||||
{
|
||||
// check for 'DOMDocumentTypeImpl' or '+DOMDocumentTypeImpl'
|
||||
if(feature && *feature)
|
||||
{
|
||||
if((*feature==chPlus && XMLString::equals(feature+1, XMLUni::fgXercescInterfaceDOMDocumentTypeImpl)) ||
|
||||
XMLString::equals(feature, XMLUni::fgXercescInterfaceDOMDocumentTypeImpl))
|
||||
return true;
|
||||
}
|
||||
return fNode.isSupported (feature, version);
|
||||
}
|
||||
|
||||
void* DOMDocumentTypeImpl::getFeature(const XMLCh* feature, const XMLCh* version) const
|
||||
{
|
||||
if(XMLString::equals(feature, XMLUni::fgXercescInterfaceDOMDocumentTypeImpl))
|
||||
return (DOMDocumentTypeImpl*)this;
|
||||
return fNode.getFeature(feature,version);
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMDocumentTypeImpl.hpp 641193 2008-03-26 08:06:57Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTTYPEIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTTYPEIMPL_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMDocumentType.hpp>
|
||||
#include "DOMNodeImpl.hpp"
|
||||
#include "DOMChildNode.hpp"
|
||||
#include "DOMParentNode.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMNamedNodeMapImpl;
|
||||
|
||||
class CDOM_EXPORT DOMDocumentTypeImpl: public DOMDocumentType {
|
||||
protected:
|
||||
DOMNodeImpl fNode;
|
||||
DOMParentNode fParent;
|
||||
DOMChildNode fChild;
|
||||
|
||||
const XMLCh * fName;
|
||||
DOMNamedNodeMapImpl* fEntities;
|
||||
DOMNamedNodeMapImpl* fNotations;
|
||||
DOMNamedNodeMapImpl* fElements;
|
||||
const XMLCh * fPublicId;
|
||||
const XMLCh * fSystemId;
|
||||
const XMLCh * fInternalSubset;
|
||||
|
||||
bool fIntSubsetReading;
|
||||
bool fIsCreatedFromHeap;
|
||||
|
||||
virtual void setPublicId(const XMLCh * value);
|
||||
virtual void setSystemId(const XMLCh * value);
|
||||
virtual void setInternalSubset(const XMLCh *value);
|
||||
bool isIntSubsetReading() const;
|
||||
|
||||
friend class AbstractDOMParser;
|
||||
friend class DOMDocumentImpl;
|
||||
|
||||
public:
|
||||
DOMDocumentTypeImpl(DOMDocument *, const XMLCh *, bool);
|
||||
DOMDocumentTypeImpl(DOMDocument *,
|
||||
const XMLCh *qualifiedName, //DOM Level 2
|
||||
const XMLCh *publicId, const XMLCh *systemId, bool);
|
||||
DOMDocumentTypeImpl(const DOMDocumentTypeImpl &other, bool heap, bool deep=false);
|
||||
virtual ~DOMDocumentTypeImpl();
|
||||
|
||||
public:
|
||||
// Declare all of the functions from DOMNode.
|
||||
DOMNODE_FUNCTIONS;
|
||||
|
||||
public:
|
||||
virtual void setOwnerDocument(DOMDocument *doc);
|
||||
virtual DOMNamedNodeMap * getEntities() const;
|
||||
virtual const XMLCh * getName() const;
|
||||
virtual DOMNamedNodeMap * getNotations() const;
|
||||
virtual DOMNamedNodeMap * getElements() const;
|
||||
virtual void setReadOnly(bool readOnly, bool deep);
|
||||
|
||||
//Introduced in DOM Level 2
|
||||
|
||||
virtual const XMLCh * getPublicId() const;
|
||||
virtual const XMLCh * getSystemId() const;
|
||||
virtual const XMLCh * getInternalSubset() const;
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMDocumentTypeImpl & operator = (const DOMDocumentTypeImpl &);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,880 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMElementImpl.cpp 901107 2010-01-20 08:45:02Z borisk $
|
||||
*/
|
||||
|
||||
#include "DOMElementImpl.hpp"
|
||||
|
||||
#include <xercesc/dom/DOMAttr.hpp>
|
||||
#include <xercesc/dom/DOMDocument.hpp>
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
#include <xercesc/util/XMLUniDefs.hpp>
|
||||
#include <xercesc/util/XMLUri.hpp>
|
||||
|
||||
#include "DOMAttrMapImpl.hpp"
|
||||
#include "DOMAttrImpl.hpp"
|
||||
#include "DOMDocumentImpl.hpp"
|
||||
#include "DOMParentNode.hpp"
|
||||
#include "DOMCasts.hpp"
|
||||
#include "DOMElementNSImpl.hpp"
|
||||
#include "DOMTypeInfoImpl.hpp"
|
||||
|
||||
#include "DOMDocumentTypeImpl.hpp"
|
||||
#include <xercesc/util/OutOfMemoryException.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMAttr;
|
||||
|
||||
DOMElementImpl::DOMElementImpl(DOMDocument *ownerDoc, const XMLCh *eName)
|
||||
: fNode(ownerDoc), fParent(ownerDoc), fAttributes(0), fDefaultAttributes(0)
|
||||
{
|
||||
DOMDocumentImpl *docImpl = (DOMDocumentImpl *)ownerDoc;
|
||||
fName = docImpl->getPooledString(eName);
|
||||
setupDefaultAttributes();
|
||||
if (!fDefaultAttributes) {
|
||||
fDefaultAttributes = new (docImpl) DOMAttrMapImpl(this);
|
||||
fAttributes = new (docImpl) DOMAttrMapImpl(this);
|
||||
}
|
||||
else {
|
||||
fAttributes = new (docImpl) DOMAttrMapImpl(this, fDefaultAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DOMElementImpl::DOMElementImpl(const DOMElementImpl &other, bool deep)
|
||||
: DOMElement(other),
|
||||
fNode (other.fParent.fOwnerDocument),
|
||||
fParent (other.fParent.fOwnerDocument),
|
||||
fAttributes(0),
|
||||
fDefaultAttributes(0)
|
||||
{
|
||||
fName = other.fName;
|
||||
|
||||
if (deep)
|
||||
fParent.cloneChildren(&other);
|
||||
|
||||
if (other.getAttributes())
|
||||
{
|
||||
fAttributes = ((DOMAttrMapImpl *)other.getAttributes())->cloneAttrMap(this);
|
||||
}
|
||||
|
||||
if (other.getDefaultAttributes())
|
||||
{
|
||||
fDefaultAttributes = ((DOMAttrMapImpl *)other.getDefaultAttributes())->cloneAttrMap(this);
|
||||
}
|
||||
|
||||
if (!fDefaultAttributes)
|
||||
setupDefaultAttributes();
|
||||
|
||||
if (!fDefaultAttributes)
|
||||
fDefaultAttributes = new (fParent.fOwnerDocument) DOMAttrMapImpl(this);
|
||||
|
||||
if (!fAttributes) {
|
||||
if (!fDefaultAttributes) {
|
||||
fAttributes = new (fParent.fOwnerDocument) DOMAttrMapImpl(this);
|
||||
}
|
||||
else {
|
||||
fAttributes = new (fParent.fOwnerDocument) DOMAttrMapImpl(this, fDefaultAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
DOMElementImpl::~DOMElementImpl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DOMNode *DOMElementImpl::cloneNode(bool deep) const
|
||||
{
|
||||
DOMNode* newNode = new (fParent.fOwnerDocument, DOMMemoryManager::ELEMENT_OBJECT) DOMElementImpl(*this, deep);
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
|
||||
return newNode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const XMLCh * DOMElementImpl::getNodeName() const {
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
DOMNode::NodeType DOMElementImpl::getNodeType() const {
|
||||
return DOMNode::ELEMENT_NODE;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMElementImpl::getAttribute(const XMLCh *nam) const
|
||||
{
|
||||
DOMNode * attr = fAttributes->getNamedItem(nam);
|
||||
if (attr)
|
||||
return attr->getNodeValue();
|
||||
|
||||
return XMLUni::fgZeroLenString;
|
||||
}
|
||||
|
||||
|
||||
|
||||
DOMAttr *DOMElementImpl::getAttributeNode(const XMLCh *nam) const
|
||||
{
|
||||
return (DOMAttr *)fAttributes->getNamedItem(nam);
|
||||
}
|
||||
|
||||
|
||||
DOMNamedNodeMap *DOMElementImpl::getAttributes() const
|
||||
{
|
||||
DOMElementImpl *ncThis = (DOMElementImpl *)this; // cast off const
|
||||
return ncThis->fAttributes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
DOMNodeList *DOMElementImpl::getElementsByTagName(const XMLCh *tagname) const
|
||||
{
|
||||
DOMDocumentImpl *docImpl = (DOMDocumentImpl *)fParent.fOwnerDocument;
|
||||
return docImpl->getDeepNodeList(this,tagname);
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMElementImpl::getTagName() const
|
||||
{
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
void DOMElementImpl::removeAttribute(const XMLCh *nam)
|
||||
{
|
||||
if (fNode.isReadOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
int i = fAttributes->findNamePoint(nam);
|
||||
if (i >= 0)
|
||||
{
|
||||
DOMNode *att = fAttributes->removeNamedItemAt(i);
|
||||
((DOMAttrImpl *)att)->removeAttrFromIDNodeMap();
|
||||
att->release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
DOMAttr *DOMElementImpl::removeAttributeNode(DOMAttr *oldAttr)
|
||||
{
|
||||
if (fNode.isReadOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMNode* found = 0;
|
||||
|
||||
// Since there is no removeAttributeNodeNS, check if this oldAttr has NS or not
|
||||
const XMLCh* localName = oldAttr->getLocalName();
|
||||
int i = 0;
|
||||
if (localName)
|
||||
i = fAttributes->findNamePoint(oldAttr->getNamespaceURI(), localName);
|
||||
else
|
||||
i = fAttributes->findNamePoint(oldAttr->getName());
|
||||
|
||||
if (i >= 0) {
|
||||
// If it is in fact the right object, remove it.
|
||||
found = fAttributes->item(i);
|
||||
if (found == oldAttr) {
|
||||
fAttributes->removeNamedItemAt(i);
|
||||
((DOMAttrImpl *)oldAttr)->removeAttrFromIDNodeMap();
|
||||
}
|
||||
else
|
||||
throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
}
|
||||
else
|
||||
throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
return (DOMAttr *)found;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DOMElementImpl::setAttribute(const XMLCh *nam, const XMLCh *val)
|
||||
{
|
||||
if (fNode.isReadOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMAttr* newAttr = getAttributeNode(nam);
|
||||
if (!newAttr)
|
||||
{
|
||||
newAttr = fParent.fOwnerDocument->createAttribute(nam);
|
||||
fAttributes->setNamedItem(newAttr);
|
||||
}
|
||||
|
||||
newAttr->setNodeValue(val);
|
||||
}
|
||||
|
||||
void DOMElementImpl::setIdAttribute(const XMLCh* name, bool isId)
|
||||
{
|
||||
if (fNode.isReadOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMAttr *attr = getAttributeNode(name);
|
||||
|
||||
if (!attr)
|
||||
throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
if(isId)
|
||||
((DOMAttrImpl *)attr)->addAttrToIDNodeMap();
|
||||
else
|
||||
((DOMAttrImpl *)attr)->removeAttrFromIDNodeMap();
|
||||
}
|
||||
|
||||
void DOMElementImpl::setIdAttributeNS(const XMLCh* namespaceURI, const XMLCh* localName, bool isId) {
|
||||
|
||||
if (fNode.isReadOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMAttr *attr = getAttributeNodeNS(namespaceURI, localName);
|
||||
|
||||
if (!attr)
|
||||
throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
if(isId)
|
||||
((DOMAttrImpl *)attr)->addAttrToIDNodeMap();
|
||||
else
|
||||
((DOMAttrImpl *)attr)->removeAttrFromIDNodeMap();
|
||||
}
|
||||
|
||||
|
||||
void DOMElementImpl::setIdAttributeNode(const DOMAttr *idAttr, bool isId) {
|
||||
|
||||
if (fNode.isReadOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMAttr *attr;
|
||||
const XMLCh* localName = idAttr->getLocalName();
|
||||
if (localName)
|
||||
attr = getAttributeNodeNS(idAttr->getNamespaceURI(), idAttr->getLocalName());
|
||||
else
|
||||
attr = getAttributeNode(idAttr->getName());
|
||||
|
||||
if(!attr)
|
||||
throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
if(isId)
|
||||
((DOMAttrImpl *)attr)->addAttrToIDNodeMap();
|
||||
else
|
||||
((DOMAttrImpl *)attr)->removeAttrFromIDNodeMap();
|
||||
}
|
||||
|
||||
|
||||
DOMAttr * DOMElementImpl::setAttributeNode(DOMAttr *newAttr)
|
||||
{
|
||||
if (fNode.isReadOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
if (newAttr->getNodeType() != DOMNode::ATTRIBUTE_NODE)
|
||||
throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNodeMemoryManager);
|
||||
// revisit. Exception doesn't match test.
|
||||
|
||||
// This will throw INUSE if necessary
|
||||
DOMAttr *oldAttr = (DOMAttr *) fAttributes->setNamedItem(newAttr);
|
||||
|
||||
return oldAttr;
|
||||
}
|
||||
|
||||
|
||||
void DOMElementImpl::setNodeValue(const XMLCh *x)
|
||||
{
|
||||
fNode.setNodeValue(x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DOMElementImpl::setReadOnly(bool readOnl, bool deep)
|
||||
{
|
||||
fNode.setReadOnly(readOnl,deep);
|
||||
fAttributes->setReadOnly(readOnl,true);
|
||||
}
|
||||
|
||||
|
||||
//Introduced in DOM Level 2
|
||||
const XMLCh * DOMElementImpl::getAttributeNS(const XMLCh *fNamespaceURI,
|
||||
const XMLCh *fLocalName) const
|
||||
{
|
||||
DOMAttr * attr=
|
||||
(DOMAttr *)(fAttributes->getNamedItemNS(fNamespaceURI, fLocalName));
|
||||
return (attr==0) ? XMLUni::fgZeroLenString : attr->getValue();
|
||||
}
|
||||
|
||||
|
||||
void DOMElementImpl::setAttributeNS(const XMLCh *fNamespaceURI,
|
||||
const XMLCh *qualifiedName, const XMLCh *fValue)
|
||||
{
|
||||
if (fNode.isReadOnly())
|
||||
throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
int index = DOMDocumentImpl::indexofQualifiedName(qualifiedName);
|
||||
if (index < 0)
|
||||
throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMAttr* newAttr = getAttributeNodeNS(fNamespaceURI, qualifiedName+index);
|
||||
if (!newAttr)
|
||||
{
|
||||
newAttr = fParent.fOwnerDocument->createAttributeNS(fNamespaceURI, qualifiedName);
|
||||
fAttributes->setNamedItemNS(newAttr);
|
||||
}
|
||||
|
||||
newAttr->setNodeValue(fValue);
|
||||
}
|
||||
|
||||
|
||||
void DOMElementImpl::removeAttributeNS(const XMLCh *fNamespaceURI,
|
||||
const XMLCh *fLocalName)
|
||||
{
|
||||
if (fNode.isReadOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
int i = fAttributes->findNamePoint(fNamespaceURI, fLocalName);
|
||||
if (i >= 0)
|
||||
{
|
||||
DOMNode *att = fAttributes->removeNamedItemAt(i);
|
||||
att->release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DOMAttr *DOMElementImpl::getAttributeNodeNS(const XMLCh *fNamespaceURI,
|
||||
const XMLCh *fLocalName) const
|
||||
{
|
||||
return (DOMAttr *)fAttributes->getNamedItemNS(fNamespaceURI, fLocalName);
|
||||
}
|
||||
|
||||
|
||||
DOMAttr *DOMElementImpl::setAttributeNodeNS(DOMAttr *newAttr)
|
||||
{
|
||||
if (fNode.isReadOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
if (newAttr -> getOwnerDocument() != fParent.fOwnerDocument)
|
||||
throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
// This will throw INUSE if necessary
|
||||
DOMAttr *oldAttr = (DOMAttr *) fAttributes->setNamedItemNS(newAttr);
|
||||
|
||||
return oldAttr;
|
||||
}
|
||||
|
||||
|
||||
DOMNodeList *DOMElementImpl::getElementsByTagNameNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const
|
||||
{
|
||||
DOMDocumentImpl *docImpl = (DOMDocumentImpl *)fParent.fOwnerDocument;
|
||||
return docImpl->getDeepNodeList(this, namespaceURI, localName);
|
||||
}
|
||||
|
||||
bool DOMElementImpl::hasAttributes() const
|
||||
{
|
||||
return (fAttributes != 0 && fAttributes->getLength() != 0);
|
||||
}
|
||||
|
||||
|
||||
bool DOMElementImpl::hasAttribute(const XMLCh *name) const
|
||||
{
|
||||
return (getAttributeNode(name) != 0);
|
||||
}
|
||||
|
||||
|
||||
bool DOMElementImpl::hasAttributeNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const
|
||||
{
|
||||
return (getAttributeNodeNS(namespaceURI, localName) != 0);
|
||||
}
|
||||
|
||||
|
||||
// util functions for default attributes
|
||||
// returns the default attribute map for this node from the owner document
|
||||
DOMAttrMapImpl *DOMElementImpl::getDefaultAttributes() const
|
||||
{
|
||||
return fDefaultAttributes;
|
||||
}
|
||||
|
||||
// initially set up the default attribute information based on doctype information
|
||||
void DOMElementImpl::setupDefaultAttributes()
|
||||
{
|
||||
DOMDocument *tmpdoc = fParent.fOwnerDocument;
|
||||
if ((fNode.fOwnerNode == 0) || (tmpdoc == 0) || (tmpdoc->getDoctype() == 0))
|
||||
return;
|
||||
|
||||
DOMNode *eldef = ((DOMDocumentTypeImpl*)tmpdoc->getDoctype())->getElements()->getNamedItem(getNodeName());
|
||||
DOMAttrMapImpl* defAttrs = (eldef == 0) ? 0 : (DOMAttrMapImpl *)(eldef->getAttributes());
|
||||
|
||||
if (defAttrs)
|
||||
fDefaultAttributes = new (tmpdoc) DOMAttrMapImpl(this, defAttrs);
|
||||
}
|
||||
|
||||
DOMAttr * DOMElementImpl::setDefaultAttributeNode(DOMAttr *newAttr)
|
||||
{
|
||||
if (fNode.isReadOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
if (newAttr->getNodeType() != DOMNode::ATTRIBUTE_NODE)
|
||||
throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNodeMemoryManager);
|
||||
// revisit. Exception doesn't match test.
|
||||
|
||||
// This will throw INUSE if necessary
|
||||
DOMAttr *oldAttr = (DOMAttr *) fDefaultAttributes->setNamedItem(newAttr);
|
||||
fAttributes->hasDefaults(true);
|
||||
|
||||
return oldAttr;
|
||||
}
|
||||
|
||||
|
||||
DOMAttr *DOMElementImpl::setDefaultAttributeNodeNS(DOMAttr *newAttr)
|
||||
{
|
||||
if (fNode.isReadOnly())
|
||||
throw DOMException(
|
||||
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
if (newAttr -> getOwnerDocument() != fParent.fOwnerDocument)
|
||||
throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
// This will throw INUSE if necessary
|
||||
DOMAttr *oldAttr = (DOMAttr *) fDefaultAttributes->setNamedItemNS(newAttr);
|
||||
fAttributes->hasDefaults(true);
|
||||
|
||||
return oldAttr;
|
||||
}
|
||||
|
||||
void DOMElementImpl::release()
|
||||
{
|
||||
if (fNode.isOwned() && !fNode.isToBeReleased())
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument;
|
||||
if (doc) {
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
|
||||
// release children
|
||||
fParent.release();
|
||||
// release attributes
|
||||
fAttributes->hasDefaults(false);
|
||||
XMLSize_t count;
|
||||
while((count = fAttributes->getLength()) != 0)
|
||||
{
|
||||
DOMNode* attr = fAttributes->removeNamedItemAt(count-1);
|
||||
attr->release();
|
||||
}
|
||||
|
||||
doc->release(this, DOMMemoryManager::ELEMENT_OBJECT);
|
||||
}
|
||||
else {
|
||||
// shouldn't reach here
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
}
|
||||
|
||||
const XMLCh* DOMElementImpl::getBaseURI() const
|
||||
{
|
||||
const XMLCh* baseURI = fNode.fOwnerNode->getBaseURI();
|
||||
if (fAttributes) {
|
||||
const XMLCh baseString[] =
|
||||
{
|
||||
chLatin_b, chLatin_a, chLatin_s, chLatin_e, chNull
|
||||
};
|
||||
DOMNode* attrNode = fAttributes->getNamedItemNS(DOMNodeImpl::getXmlURIString(), baseString);
|
||||
if (attrNode==NULL) {
|
||||
const XMLCh xmlBaseString[] =
|
||||
{
|
||||
chLatin_x, chLatin_m, chLatin_l, chColon, chLatin_b, chLatin_a, chLatin_s, chLatin_e, chNull
|
||||
};
|
||||
attrNode = fAttributes->getNamedItem(xmlBaseString);
|
||||
}
|
||||
if (attrNode) {
|
||||
const XMLCh* uri = attrNode->getNodeValue();
|
||||
if (uri && *uri) {// attribute value is always empty string
|
||||
// if there is a base URI for the parent node, use it to resolve relative URI
|
||||
if(baseURI)
|
||||
{
|
||||
try {
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl *)fParent.fOwnerDocument;
|
||||
XMLUri temp(baseURI, doc->getMemoryManager());
|
||||
XMLUri temp2(&temp, uri, doc->getMemoryManager());
|
||||
uri = doc->cloneString(temp2.getUriText());
|
||||
}
|
||||
catch(const OutOfMemoryException&)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (...){
|
||||
// REVISIT: what should happen in this case?
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
}
|
||||
return baseURI;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Functions inherited from Node
|
||||
//
|
||||
DOMNode* DOMElementImpl::appendChild(DOMNode *newChild) {return fParent.appendChild (newChild); }
|
||||
DOMNodeList* DOMElementImpl::getChildNodes() const {return fParent.getChildNodes (); }
|
||||
DOMNode* DOMElementImpl::getFirstChild() const {return fParent.getFirstChild (); }
|
||||
DOMNode* DOMElementImpl::getLastChild() const {return fParent.getLastChild (); }
|
||||
const XMLCh* DOMElementImpl::getLocalName() const {return fNode.getLocalName (); }
|
||||
const XMLCh* DOMElementImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); }
|
||||
DOMNode* DOMElementImpl::getNextSibling() const {return fChild.getNextSibling (); }
|
||||
const XMLCh* DOMElementImpl::getNodeValue() const {return fNode.getNodeValue (); }
|
||||
DOMDocument* DOMElementImpl::getOwnerDocument() const {return fParent.fOwnerDocument; }
|
||||
const XMLCh* DOMElementImpl::getPrefix() const {return fNode.getPrefix (); }
|
||||
DOMNode* DOMElementImpl::getParentNode() const {return fChild.getParentNode (this); }
|
||||
DOMNode* DOMElementImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); }
|
||||
bool DOMElementImpl::hasChildNodes() const {return fParent.hasChildNodes (); }
|
||||
DOMNode* DOMElementImpl::insertBefore(DOMNode *newChild, DOMNode *refChild)
|
||||
{return fParent.insertBefore (newChild, refChild); }
|
||||
void DOMElementImpl::normalize() {fParent.normalize (); }
|
||||
DOMNode* DOMElementImpl::removeChild(DOMNode *oldChild) {return fParent.removeChild (oldChild); }
|
||||
DOMNode* DOMElementImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild)
|
||||
{return fParent.replaceChild (newChild, oldChild); }
|
||||
bool DOMElementImpl::isSupported(const XMLCh *feature, const XMLCh *version) const
|
||||
{return fNode.isSupported (feature, version); }
|
||||
void DOMElementImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); }
|
||||
bool DOMElementImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); }
|
||||
void* DOMElementImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler)
|
||||
{return fNode.setUserData(key, data, handler); }
|
||||
void* DOMElementImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); }
|
||||
short DOMElementImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); }
|
||||
const XMLCh* DOMElementImpl::getTextContent() const {return fNode.getTextContent(); }
|
||||
void DOMElementImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); }
|
||||
const XMLCh* DOMElementImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); }
|
||||
bool DOMElementImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); }
|
||||
const XMLCh* DOMElementImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); }
|
||||
void* DOMElementImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); }
|
||||
|
||||
|
||||
|
||||
bool DOMElementImpl::isEqualNode(const DOMNode* arg) const
|
||||
{
|
||||
if (isSameNode(arg)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!fNode.isEqualNode(arg)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hasAttrs = hasAttributes();
|
||||
|
||||
if (hasAttrs != arg->hasAttributes()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hasAttrs) {
|
||||
DOMNamedNodeMap* map1 = getAttributes();
|
||||
DOMNamedNodeMap* map2 = arg->getAttributes();
|
||||
|
||||
XMLSize_t len = map1->getLength();
|
||||
if (len != map2->getLength()) {
|
||||
return false;
|
||||
}
|
||||
for (XMLSize_t i = 0; i < len; i++) {
|
||||
DOMNode* n1 = map1->item(i);
|
||||
if (!n1->getLocalName()) { // DOM Level 1 Node
|
||||
DOMNode* n2 = map2->getNamedItem(n1->getNodeName());
|
||||
if (!n2 || !n1->isEqualNode(n2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
DOMNode* n2 = map2->getNamedItemNS(n1->getNamespaceURI(),
|
||||
n1->getLocalName());
|
||||
if (!n2 || !n1->isEqualNode(n2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fParent.isEqualNode(arg);
|
||||
}
|
||||
|
||||
DOMNode* DOMElementImpl::rename(const XMLCh* namespaceURI, const XMLCh* name)
|
||||
{
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument;
|
||||
|
||||
if (!namespaceURI || !*namespaceURI) {
|
||||
fName = doc->getPooledString(name);
|
||||
fAttributes->reconcileDefaultAttributes(getDefaultAttributes());
|
||||
|
||||
// and fire user data NODE_RENAMED event
|
||||
castToNodeImpl(this)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, this);
|
||||
|
||||
return this;
|
||||
}
|
||||
else {
|
||||
|
||||
// create a new ElementNS
|
||||
DOMElementNSImpl* newElem = (DOMElementNSImpl*)doc->createElementNS(namespaceURI, name);
|
||||
|
||||
// transfer the userData
|
||||
doc->transferUserData(castToNodeImpl(this), castToNodeImpl(newElem));
|
||||
|
||||
// remove old node from parent if any
|
||||
DOMNode* parent = getParentNode();
|
||||
DOMNode* nextSib = getNextSibling();
|
||||
if (parent) {
|
||||
parent->removeChild(this);
|
||||
}
|
||||
|
||||
// move children to new node
|
||||
DOMNode* child = getFirstChild();
|
||||
while (child) {
|
||||
removeChild(child);
|
||||
newElem->appendChild(child);
|
||||
child = getFirstChild();
|
||||
}
|
||||
|
||||
// insert new node where old one was
|
||||
if (parent) {
|
||||
parent->insertBefore(newElem, nextSib);
|
||||
}
|
||||
|
||||
// move specified attributes to new node
|
||||
newElem->fAttributes->moveSpecifiedAttributes(fAttributes);
|
||||
|
||||
// and fire user data NODE_RENAMED event
|
||||
castToNodeImpl(newElem)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, newElem);
|
||||
|
||||
return newElem;
|
||||
}
|
||||
}
|
||||
|
||||
const DOMTypeInfo *DOMElementImpl::getSchemaTypeInfo() const
|
||||
{
|
||||
return &DOMTypeInfoImpl::g_DtdValidatedElement;
|
||||
}
|
||||
|
||||
// DOMElementTraversal
|
||||
DOMElement * DOMElementImpl::getFirstElementChild() const
|
||||
{
|
||||
DOMNode* n = getFirstChild();
|
||||
while (n != NULL) {
|
||||
switch (n->getNodeType()) {
|
||||
case DOMNode::ELEMENT_NODE:
|
||||
return (DOMElement*) n;
|
||||
case DOMNode::ENTITY_REFERENCE_NODE:
|
||||
{
|
||||
DOMElement* e = getFirstElementChild(n);
|
||||
if (e != NULL)
|
||||
return e;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
n = n->getNextSibling();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DOMElement * DOMElementImpl::getLastElementChild() const
|
||||
{
|
||||
DOMNode* n = getLastChild();
|
||||
while (n != NULL) {
|
||||
switch (n->getNodeType()) {
|
||||
case DOMNode::ELEMENT_NODE:
|
||||
return (DOMElement*) n;
|
||||
case DOMNode::ENTITY_REFERENCE_NODE:
|
||||
{
|
||||
DOMElement* e = getLastElementChild(n);
|
||||
if (e != NULL)
|
||||
return e;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
n = n->getPreviousSibling();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DOMElement * DOMElementImpl::getNextElementSibling() const
|
||||
{
|
||||
DOMNode* n = getNextLogicalSibling(this);
|
||||
while (n != NULL) {
|
||||
switch (n->getNodeType()) {
|
||||
case DOMNode::ELEMENT_NODE:
|
||||
return (DOMElement*) n;
|
||||
case DOMNode::ENTITY_REFERENCE_NODE:
|
||||
{
|
||||
DOMElement* e = getFirstElementChild(n);
|
||||
if (e != NULL)
|
||||
return e;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
n = getNextLogicalSibling(n);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DOMElement * DOMElementImpl::getPreviousElementSibling() const
|
||||
{
|
||||
DOMNode* n = getPreviousLogicalSibling(this);
|
||||
while (n != NULL) {
|
||||
switch (n->getNodeType()) {
|
||||
case DOMNode::ELEMENT_NODE:
|
||||
return (DOMElement*) n;
|
||||
case DOMNode::ENTITY_REFERENCE_NODE:
|
||||
{
|
||||
DOMElement* e = getLastElementChild(n);
|
||||
if (e != NULL)
|
||||
return e;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
n = getPreviousLogicalSibling(n);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
XMLSize_t DOMElementImpl::getChildElementCount() const
|
||||
{
|
||||
XMLSize_t count = 0;
|
||||
DOMElement* child = getFirstElementChild();
|
||||
while (child != NULL) {
|
||||
++count;
|
||||
child = child->getNextElementSibling();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// Returns the first element node found from a
|
||||
// non-recursive in order traversal of the given node.
|
||||
DOMElement* DOMElementImpl::getFirstElementChild(const DOMNode* n) const
|
||||
{
|
||||
const DOMNode* top = n;
|
||||
while (n != NULL) {
|
||||
if (n->getNodeType() == DOMNode::ELEMENT_NODE) {
|
||||
return (DOMElement*) n;
|
||||
}
|
||||
DOMNode* next = n->getFirstChild();
|
||||
while (next == NULL) {
|
||||
if (top == n) {
|
||||
break;
|
||||
}
|
||||
next = n->getNextSibling();
|
||||
if (next == NULL) {
|
||||
n = n->getParentNode();
|
||||
if (n == NULL || top == n) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
n = next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Returns the first element node found from a
|
||||
// non-recursive reverse order traversal of the given node.
|
||||
DOMElement* DOMElementImpl::getLastElementChild(const DOMNode* n) const
|
||||
{
|
||||
const DOMNode* top = n;
|
||||
while (n != NULL) {
|
||||
if (n->getNodeType() == DOMNode::ELEMENT_NODE) {
|
||||
return (DOMElement*) n;
|
||||
}
|
||||
DOMNode* next = n->getLastChild();
|
||||
while (next == NULL) {
|
||||
if (top == n) {
|
||||
break;
|
||||
}
|
||||
next = n->getPreviousSibling();
|
||||
if (next == NULL) {
|
||||
n = n->getParentNode();
|
||||
if (n == NULL || top == n) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
n = next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Returns the next logical sibling with respect to the given node.
|
||||
DOMNode* DOMElementImpl::getNextLogicalSibling(const DOMNode* n) const
|
||||
{
|
||||
DOMNode* next = n->getNextSibling();
|
||||
// If "n" has no following sibling and its parent is an entity reference node we
|
||||
// need to continue the search through the following siblings of the entity
|
||||
// reference as these are logically siblings of the given node.
|
||||
if (next == NULL) {
|
||||
DOMNode* parent = n->getParentNode();
|
||||
while (parent != NULL && parent->getNodeType() == DOMNode::ENTITY_REFERENCE_NODE) {
|
||||
next = parent->getNextSibling();
|
||||
if (next != NULL) {
|
||||
break;
|
||||
}
|
||||
parent = parent->getParentNode();
|
||||
}
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
||||
// Returns the previous logical sibling with respect to the given node.
|
||||
DOMNode* DOMElementImpl::getPreviousLogicalSibling(const DOMNode* n) const
|
||||
{
|
||||
DOMNode* prev = n->getPreviousSibling();
|
||||
// If "n" has no previous sibling and its parent is an entity reference node we
|
||||
// need to continue the search through the previous siblings of the entity
|
||||
// reference as these are logically siblings of the given node.
|
||||
if (prev == NULL) {
|
||||
DOMNode* parent = n->getParentNode();
|
||||
while (parent != NULL && parent->getNodeType() == DOMNode::ENTITY_REFERENCE_NODE) {
|
||||
prev = parent->getPreviousSibling();
|
||||
if (prev != NULL) {
|
||||
break;
|
||||
}
|
||||
parent = parent->getParentNode();
|
||||
}
|
||||
}
|
||||
return prev;
|
||||
}
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMElementImpl.hpp 792236 2009-07-08 17:22:35Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMELEMENTIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMELEMENTIMPL_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
#include <xercesc/dom/DOMElement.hpp>
|
||||
|
||||
#include "DOMChildNode.hpp"
|
||||
#include "DOMNodeImpl.hpp"
|
||||
#include "DOMParentNode.hpp"
|
||||
|
||||
#include "DOMAttrMapImpl.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMTypeInfo;
|
||||
class DOMNodeList;
|
||||
class DOMAttrMapImpl;
|
||||
class DOMDocument;
|
||||
|
||||
|
||||
|
||||
|
||||
class CDOM_EXPORT DOMElementImpl: public DOMElement {
|
||||
public:
|
||||
DOMNodeImpl fNode;
|
||||
DOMParentNode fParent;
|
||||
DOMChildNode fChild;
|
||||
DOMAttrMapImpl *fAttributes;
|
||||
DOMAttrMapImpl *fDefaultAttributes;
|
||||
const XMLCh *fName;
|
||||
|
||||
public:
|
||||
DOMElementImpl(DOMDocument *ownerDoc, const XMLCh *name);
|
||||
|
||||
DOMElementImpl(const DOMElementImpl &other, bool deep=false);
|
||||
virtual ~DOMElementImpl();
|
||||
|
||||
public:
|
||||
// Declare functions from DOMNode. They all must be implemented by this class
|
||||
DOMNODE_FUNCTIONS;
|
||||
|
||||
public:
|
||||
// Functions introduced on Element...
|
||||
virtual const XMLCh* getAttribute(const XMLCh *name) const;
|
||||
virtual DOMAttr* getAttributeNode(const XMLCh *name) const;
|
||||
virtual DOMNodeList* getElementsByTagName(const XMLCh *tagname) const;
|
||||
virtual const XMLCh* getTagName() const;
|
||||
virtual void removeAttribute(const XMLCh *name);
|
||||
virtual DOMAttr* removeAttributeNode(DOMAttr * oldAttr);
|
||||
virtual void setAttribute(const XMLCh *name, const XMLCh *value);
|
||||
virtual DOMAttr* setAttributeNode(DOMAttr *newAttr);
|
||||
virtual void setReadOnly(bool readOnly, bool deep);
|
||||
|
||||
//Introduced in DOM Level 2
|
||||
virtual const XMLCh* getAttributeNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const;
|
||||
virtual void setAttributeNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *qualifiedName,
|
||||
const XMLCh *value);
|
||||
virtual void removeAttributeNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName);
|
||||
virtual DOMAttr* getAttributeNodeNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const;
|
||||
virtual DOMAttr* setAttributeNodeNS(DOMAttr *newAttr);
|
||||
virtual DOMNodeList* getElementsByTagNameNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const;
|
||||
virtual bool hasAttribute(const XMLCh *name) const;
|
||||
virtual bool hasAttributeNS(const XMLCh *namespaceURI,
|
||||
const XMLCh *localName) const;
|
||||
|
||||
//Introduced in DOM level 3
|
||||
virtual void setIdAttribute(const XMLCh* name, bool isId);
|
||||
virtual void setIdAttributeNS(const XMLCh* namespaceURI, const XMLCh* localName, bool isId);
|
||||
virtual void setIdAttributeNode(const DOMAttr *idAttr, bool isId);
|
||||
virtual const DOMTypeInfo * getSchemaTypeInfo() const;
|
||||
|
||||
// for handling of default attribute
|
||||
virtual DOMAttr* setDefaultAttributeNode(DOMAttr *newAttr);
|
||||
virtual DOMAttr* setDefaultAttributeNodeNS(DOMAttr *newAttr);
|
||||
virtual DOMAttrMapImpl* getDefaultAttributes() const;
|
||||
|
||||
// helper function for DOM Level 3 renameNode
|
||||
virtual DOMNode* rename(const XMLCh* namespaceURI, const XMLCh* name);
|
||||
|
||||
// DOMElementTraversal
|
||||
virtual DOMElement * getFirstElementChild() const;
|
||||
virtual DOMElement * getLastElementChild() const;
|
||||
virtual DOMElement * getPreviousElementSibling() const;
|
||||
virtual DOMElement * getNextElementSibling() const;
|
||||
virtual XMLSize_t getChildElementCount() const;
|
||||
|
||||
protected:
|
||||
// default attribute helper functions
|
||||
virtual void setupDefaultAttributes();
|
||||
|
||||
// helper function for DOMElementTraversal methods
|
||||
DOMElement* getFirstElementChild(const DOMNode* n) const;
|
||||
DOMElement* getLastElementChild(const DOMNode* n) const;
|
||||
DOMNode* getNextLogicalSibling(const DOMNode* n) const;
|
||||
DOMNode* getPreviousLogicalSibling(const DOMNode* n) const;
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMElementImpl & operator = (const DOMElementImpl &);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,264 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMElementNSImpl.cpp 678709 2008-07-22 10:56:56Z borisk $
|
||||
*/
|
||||
|
||||
#include <xercesc/util/XMLUniDefs.hpp>
|
||||
#include "DOMElementNSImpl.hpp"
|
||||
#include "DOMDocumentImpl.hpp"
|
||||
#include "DOMTypeInfoImpl.hpp"
|
||||
#include "DOMCasts.hpp"
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
#include <xercesc/util/XMLUri.hpp>
|
||||
#include <xercesc/util/OutOfMemoryException.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
DOMElementNSImpl::DOMElementNSImpl(DOMDocument *ownerDoc, const XMLCh *nam) :
|
||||
DOMElementImpl(ownerDoc, nam)
|
||||
{
|
||||
this->fNamespaceURI=0; //DOM Level 2
|
||||
this->fLocalName=0; //DOM Level 2
|
||||
this->fPrefix=0;
|
||||
this->fSchemaType = 0;
|
||||
}
|
||||
|
||||
//Introduced in DOM Level 2
|
||||
DOMElementNSImpl::DOMElementNSImpl(DOMDocument *ownerDoc,
|
||||
const XMLCh *namespaceURI,
|
||||
const XMLCh *qualifiedName) :
|
||||
DOMElementImpl(ownerDoc, qualifiedName)
|
||||
{
|
||||
setName(namespaceURI, qualifiedName);
|
||||
this->fSchemaType = 0;
|
||||
}
|
||||
|
||||
DOMElementNSImpl::DOMElementNSImpl(DOMDocument *ownerDoc,
|
||||
const XMLCh *namespaceURI,
|
||||
const XMLCh *prefix,
|
||||
const XMLCh *localName,
|
||||
const XMLCh *qualifiedName)
|
||||
: DOMElementImpl(ownerDoc, qualifiedName)
|
||||
{
|
||||
this->fSchemaType = 0;
|
||||
|
||||
DOMDocumentImpl* docImpl = (DOMDocumentImpl*)fParent.fOwnerDocument;
|
||||
|
||||
if (prefix == 0 || *prefix == 0)
|
||||
{
|
||||
fPrefix = 0;
|
||||
fLocalName = fName;
|
||||
}
|
||||
else
|
||||
{
|
||||
fPrefix = docImpl->getPooledString(prefix);
|
||||
fLocalName = docImpl->getPooledString(localName);
|
||||
}
|
||||
|
||||
// DOM Level 3: namespace URI is never empty string.
|
||||
//
|
||||
const XMLCh * URI = DOMNodeImpl::mapPrefix (
|
||||
fPrefix,
|
||||
(!namespaceURI || !*namespaceURI) ? 0 : namespaceURI,
|
||||
DOMNode::ELEMENT_NODE);
|
||||
|
||||
fNamespaceURI = (URI == 0) ? 0 : docImpl->getPooledString(URI);
|
||||
}
|
||||
|
||||
DOMElementNSImpl::DOMElementNSImpl(const DOMElementNSImpl &other, bool deep) :
|
||||
DOMElementImpl(other, deep)
|
||||
{
|
||||
this->fNamespaceURI = other.fNamespaceURI; //DOM Level 2
|
||||
this->fLocalName = other.fLocalName; //DOM Level 2
|
||||
this->fPrefix = other.fPrefix;
|
||||
this->fSchemaType = other.fSchemaType;
|
||||
}
|
||||
|
||||
DOMNode * DOMElementNSImpl::cloneNode(bool deep) const {
|
||||
DOMNode* newNode = new (fParent.fOwnerDocument, DOMMemoryManager::ELEMENT_NS_OBJECT) DOMElementNSImpl(*this, deep);
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
|
||||
return newNode;
|
||||
}
|
||||
|
||||
const XMLCh * DOMElementNSImpl::getNamespaceURI() const
|
||||
{
|
||||
return fNamespaceURI;
|
||||
}
|
||||
|
||||
const XMLCh * DOMElementNSImpl::getPrefix() const
|
||||
{
|
||||
return fPrefix;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMElementNSImpl::getLocalName() const
|
||||
{
|
||||
return fLocalName;
|
||||
}
|
||||
|
||||
void DOMElementNSImpl::setPrefix(const XMLCh *prefix)
|
||||
{
|
||||
if (fNode.isReadOnly())
|
||||
throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
if (fNamespaceURI == 0 || fNamespaceURI[0] == chNull)
|
||||
throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
if (prefix == 0 || *prefix == 0) {
|
||||
fPrefix = 0;
|
||||
fName = fLocalName;
|
||||
return;
|
||||
}
|
||||
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument;
|
||||
|
||||
if(!doc->isXMLName(prefix))
|
||||
throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, GetDOMNodeMemoryManager);
|
||||
|
||||
const XMLCh * xml = DOMNodeImpl::getXmlString();
|
||||
const XMLCh * xmlURI = DOMNodeImpl::getXmlURIString();
|
||||
|
||||
if (XMLString::equals(prefix, xml) &&
|
||||
!XMLString::equals(fNamespaceURI, xmlURI))
|
||||
throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
|
||||
if (XMLString::indexOf(prefix, chColon) != -1) {
|
||||
throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
|
||||
this-> fPrefix = doc->getPooledString(prefix);
|
||||
|
||||
XMLSize_t prefixLen = XMLString::stringLen(prefix);
|
||||
XMLSize_t newQualifiedNameLen = prefixLen+1+XMLString::stringLen(fLocalName);
|
||||
|
||||
XMLCh *newName;
|
||||
XMLCh temp[256];
|
||||
if (newQualifiedNameLen >= 255)
|
||||
newName = (XMLCh*) doc->getMemoryManager()->allocate
|
||||
(
|
||||
newQualifiedNameLen * sizeof(XMLCh)
|
||||
);//new XMLCh[newQualifiedNameLen];
|
||||
else
|
||||
newName = temp;
|
||||
|
||||
// newName = prefix + chColon + fLocalName;
|
||||
XMLString::copyString(newName, prefix);
|
||||
newName[prefixLen] = chColon;
|
||||
XMLString::copyString(&newName[prefixLen+1], fLocalName);
|
||||
|
||||
fName = doc->getPooledString(newName);
|
||||
|
||||
if (newQualifiedNameLen >= 255)
|
||||
doc->getMemoryManager()->deallocate(newName);//delete[] newName;
|
||||
|
||||
}
|
||||
|
||||
void DOMElementNSImpl::release()
|
||||
{
|
||||
if (fNode.isOwned() && !fNode.isToBeReleased())
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument;
|
||||
if (doc) {
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
|
||||
fParent.release();
|
||||
doc->release(this, DOMMemoryManager::ELEMENT_NS_OBJECT);
|
||||
}
|
||||
else {
|
||||
// shouldn't reach here
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
}
|
||||
|
||||
DOMNode* DOMElementNSImpl::rename(const XMLCh* namespaceURI, const XMLCh* name)
|
||||
{
|
||||
setName(namespaceURI, name);
|
||||
fAttributes->reconcileDefaultAttributes(getDefaultAttributes());
|
||||
// and fire user data NODE_RENAMED event
|
||||
castToNodeImpl(this)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, this);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
void DOMElementNSImpl::setName(const XMLCh *namespaceURI,
|
||||
const XMLCh *qualifiedName)
|
||||
{
|
||||
DOMDocumentImpl* ownerDoc = (DOMDocumentImpl *) fParent.fOwnerDocument;
|
||||
this->fName = ownerDoc->getPooledString(qualifiedName);
|
||||
|
||||
int index = DOMDocumentImpl::indexofQualifiedName(qualifiedName);
|
||||
if (index < 0)
|
||||
throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
//qualifiedName contains no ':'
|
||||
//
|
||||
fPrefix = 0;
|
||||
fLocalName = fName;
|
||||
}
|
||||
else
|
||||
{ //0 < index < this->name.length()-1
|
||||
//
|
||||
fPrefix = ownerDoc->getPooledNString(qualifiedName, index);
|
||||
fLocalName = ownerDoc->getPooledString(fName+index+1);
|
||||
|
||||
// Before we carry on, we should check if the prefix or localName are valid XMLName
|
||||
if (!ownerDoc->isXMLName(fPrefix) || !ownerDoc->isXMLName(fLocalName))
|
||||
throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
|
||||
// DOM Level 3: namespace URI is never empty string.
|
||||
//
|
||||
const XMLCh * URI = DOMNodeImpl::mapPrefix (
|
||||
fPrefix,
|
||||
(!namespaceURI || !*namespaceURI) ? 0 : namespaceURI,
|
||||
DOMNode::ELEMENT_NODE);
|
||||
|
||||
fNamespaceURI = (URI == 0) ? 0 : ownerDoc->getPooledString(URI);
|
||||
}
|
||||
|
||||
const DOMTypeInfo *DOMElementNSImpl::getSchemaTypeInfo() const
|
||||
{
|
||||
if(!fSchemaType)
|
||||
return &DOMTypeInfoImpl::g_DtdValidatedElement;
|
||||
return fSchemaType;
|
||||
}
|
||||
|
||||
void DOMElementNSImpl::setSchemaTypeInfo(const DOMTypeInfoImpl* typeInfo)
|
||||
{
|
||||
fSchemaType = typeInfo;
|
||||
}
|
||||
|
||||
bool DOMElementNSImpl::isSupported(const XMLCh *feature, const XMLCh *version) const
|
||||
{
|
||||
// check for '+DOMPSVITypeInfo'
|
||||
if(feature && *feature=='+' && XMLString::equals(feature+1, XMLUni::fgXercescInterfacePSVITypeInfo))
|
||||
return true;
|
||||
return fNode.isSupported (feature, version);
|
||||
}
|
||||
|
||||
void* DOMElementNSImpl::getFeature(const XMLCh* feature, const XMLCh* version) const
|
||||
{
|
||||
if(XMLString::equals(feature, XMLUni::fgXercescInterfacePSVITypeInfo))
|
||||
return (DOMPSVITypeInfo*)fSchemaType;
|
||||
return DOMElementImpl::getFeature(feature, version);
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMElementNSImpl.hpp 678709 2008-07-22 10:56:56Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMELEMENTNSIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMELEMENTNSIMPL_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
|
||||
#include "DOMElementImpl.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMTypeInfoImpl;
|
||||
|
||||
class CDOM_EXPORT DOMElementNSImpl: public DOMElementImpl {
|
||||
protected:
|
||||
//Introduced in DOM Level 2
|
||||
const XMLCh * fNamespaceURI; //namespace URI of this node
|
||||
const XMLCh * fLocalName; //local part of qualified name
|
||||
const XMLCh * fPrefix;
|
||||
const DOMTypeInfoImpl *fSchemaType;
|
||||
|
||||
public:
|
||||
DOMElementNSImpl(DOMDocument *ownerDoc, const XMLCh *name);
|
||||
DOMElementNSImpl(DOMDocument *ownerDoc, //DOM Level 2
|
||||
const XMLCh *namespaceURI,
|
||||
const XMLCh *qualifiedName);
|
||||
DOMElementNSImpl(const DOMElementNSImpl &other, bool deep=false);
|
||||
|
||||
// Fast construction without any checks for name validity. Used in
|
||||
// parsing.
|
||||
//
|
||||
DOMElementNSImpl(DOMDocument *ownerDoc,
|
||||
const XMLCh *namespaceURI,
|
||||
const XMLCh *prefix, // Null or empty - no prefix.
|
||||
const XMLCh *localName,
|
||||
const XMLCh *qualifiedName);
|
||||
|
||||
virtual DOMNode * cloneNode(bool deep) const;
|
||||
virtual bool isSupported(const XMLCh *feature, const XMLCh *version) const;
|
||||
virtual void* getFeature(const XMLCh* feature, const XMLCh* version) const;
|
||||
|
||||
//Introduced in DOM Level 2
|
||||
virtual const XMLCh *getNamespaceURI() const;
|
||||
virtual const XMLCh *getPrefix() const;
|
||||
virtual const XMLCh *getLocalName() const;
|
||||
virtual void setPrefix(const XMLCh *prefix);
|
||||
virtual void release();
|
||||
|
||||
//Introduced in DOM Level 3
|
||||
virtual const DOMTypeInfo * getSchemaTypeInfo() const;
|
||||
|
||||
// helper function for DOM Level 3 renameNode
|
||||
virtual DOMNode* rename(const XMLCh* namespaceURI, const XMLCh* name);
|
||||
void setName(const XMLCh* namespaceURI, const XMLCh* name);
|
||||
|
||||
//helper function for DOM Level 3 TypeInfo
|
||||
virtual void setSchemaTypeInfo(const DOMTypeInfoImpl* typeInfo);
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMElementNSImpl & operator = (const DOMElementNSImpl &);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,295 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMEntityImpl.cpp 678381 2008-07-21 10:15:01Z borisk $
|
||||
*/
|
||||
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
#include <xercesc/dom/DOMEntityReference.hpp>
|
||||
#include "DOMEntityImpl.hpp"
|
||||
#include "DOMDocumentImpl.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
DOMEntityImpl::DOMEntityImpl(DOMDocument *ownerDoc, const XMLCh *eName)
|
||||
: fNode(ownerDoc),
|
||||
fParent(ownerDoc),
|
||||
fPublicId(0),
|
||||
fSystemId(0),
|
||||
fNotationName(0),
|
||||
fRefEntity(0),
|
||||
fInputEncoding(0),
|
||||
fXmlEncoding(0),
|
||||
fXmlVersion(0),
|
||||
fBaseURI(0),
|
||||
fEntityRefNodeCloned(false)
|
||||
{
|
||||
fName = ((DOMDocumentImpl *)ownerDoc)->getPooledString(eName);
|
||||
fNode.setReadOnly(true, true);
|
||||
}
|
||||
|
||||
|
||||
DOMEntityImpl::DOMEntityImpl(const DOMEntityImpl &other, bool deep)
|
||||
: DOMEntity(other),
|
||||
fNode(other.fNode),
|
||||
fParent(other.fParent),
|
||||
fName(other.fName),
|
||||
fPublicId(other.fPublicId),
|
||||
fSystemId(other.fSystemId),
|
||||
fNotationName(other.fNotationName),
|
||||
fRefEntity(other.fRefEntity),
|
||||
fInputEncoding(other.fInputEncoding),
|
||||
fXmlEncoding(other.fXmlEncoding),
|
||||
fXmlVersion(other.fXmlVersion),
|
||||
fBaseURI(other.fBaseURI),
|
||||
fEntityRefNodeCloned(false)
|
||||
{
|
||||
if (deep)
|
||||
fParent.cloneChildren(&other);
|
||||
fNode.setReadOnly(true, true);
|
||||
}
|
||||
|
||||
|
||||
DOMEntityImpl::~DOMEntityImpl() {
|
||||
}
|
||||
|
||||
|
||||
DOMNode *DOMEntityImpl::cloneNode(bool deep) const
|
||||
{
|
||||
DOMNode* newNode = new (fParent.fOwnerDocument, DOMMemoryManager::ENTITY_OBJECT) DOMEntityImpl(*this, deep);
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
|
||||
return newNode;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMEntityImpl::getNodeName() const {
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
DOMNode::NodeType DOMEntityImpl::getNodeType() const {
|
||||
return DOMNode::ENTITY_NODE;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMEntityImpl::getNotationName() const
|
||||
{
|
||||
return fNotationName;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMEntityImpl::getPublicId() const {
|
||||
return fPublicId;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMEntityImpl::getSystemId() const
|
||||
{
|
||||
return fSystemId;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh* DOMEntityImpl::getBaseURI() const
|
||||
{
|
||||
return fBaseURI;
|
||||
}
|
||||
|
||||
|
||||
void DOMEntityImpl::setNodeValue(const XMLCh *arg)
|
||||
{
|
||||
fNode.setNodeValue(arg);
|
||||
}
|
||||
|
||||
|
||||
void DOMEntityImpl::setNotationName(const XMLCh *arg)
|
||||
{
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument;
|
||||
fNotationName = doc->cloneString(arg);
|
||||
}
|
||||
|
||||
|
||||
void DOMEntityImpl::setPublicId(const XMLCh *arg)
|
||||
{
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument;
|
||||
fPublicId = doc->cloneString(arg);
|
||||
}
|
||||
|
||||
|
||||
void DOMEntityImpl::setSystemId(const XMLCh *arg)
|
||||
{
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument;
|
||||
fSystemId = doc->cloneString(arg);
|
||||
}
|
||||
|
||||
|
||||
void DOMEntityImpl::setBaseURI(const XMLCh* baseURI) {
|
||||
if (baseURI && *baseURI) {
|
||||
XMLCh* temp = (XMLCh*) ((DOMDocumentImpl *)fParent.fOwnerDocument)->allocate((XMLString::stringLen(baseURI) + 9)*sizeof(XMLCh));
|
||||
XMLString::fixURI(baseURI, temp);
|
||||
fBaseURI = temp;
|
||||
}
|
||||
else
|
||||
fBaseURI = 0;
|
||||
}
|
||||
|
||||
|
||||
void DOMEntityImpl::setEntityRef(DOMEntityReference* other)
|
||||
{
|
||||
fRefEntity = other;
|
||||
}
|
||||
|
||||
|
||||
DOMEntityReference* DOMEntityImpl::getEntityRef() const
|
||||
{
|
||||
return fRefEntity;
|
||||
}
|
||||
|
||||
void DOMEntityImpl::cloneEntityRefTree() const
|
||||
{
|
||||
if (fEntityRefNodeCloned)
|
||||
return;
|
||||
|
||||
// cast off const. This method is const because it is
|
||||
// called from a bunch of logically const methods, like
|
||||
// getFirstChild().
|
||||
DOMEntityImpl *ncThis = (DOMEntityImpl *)this;
|
||||
|
||||
//lazily clone the entityRef tree to this entity
|
||||
if (fParent.fFirstChild != 0)
|
||||
return;
|
||||
|
||||
if (!fRefEntity)
|
||||
return;
|
||||
|
||||
ncThis->fEntityRefNodeCloned = true;
|
||||
ncThis->fNode.setReadOnly(false, true);
|
||||
ncThis->fParent.cloneChildren(fRefEntity);
|
||||
ncThis->fNode.setReadOnly(true, true);
|
||||
}
|
||||
|
||||
DOMNode * DOMEntityImpl::getFirstChild() const
|
||||
{
|
||||
cloneEntityRefTree();
|
||||
return fParent.fFirstChild;
|
||||
}
|
||||
|
||||
DOMNode * DOMEntityImpl::getLastChild() const
|
||||
{
|
||||
cloneEntityRefTree();
|
||||
return fParent.getLastChild();
|
||||
}
|
||||
|
||||
DOMNodeList* DOMEntityImpl::getChildNodes() const
|
||||
{
|
||||
cloneEntityRefTree();
|
||||
return this->fParent.getChildNodes();
|
||||
|
||||
}
|
||||
|
||||
bool DOMEntityImpl::hasChildNodes() const
|
||||
{
|
||||
cloneEntityRefTree();
|
||||
return fParent.fFirstChild!=0;
|
||||
}
|
||||
|
||||
|
||||
void DOMEntityImpl::release()
|
||||
{
|
||||
if (fNode.isOwned() && !fNode.isToBeReleased())
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument;
|
||||
if (doc) {
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
|
||||
fParent.release();
|
||||
doc->release(this, DOMMemoryManager::ENTITY_OBJECT);
|
||||
}
|
||||
else {
|
||||
// shouldn't reach here
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Functions inherited from Node
|
||||
//
|
||||
|
||||
DOMNode* DOMEntityImpl::appendChild(DOMNode *newChild) {cloneEntityRefTree(); return fParent.appendChild (newChild); }
|
||||
DOMNamedNodeMap* DOMEntityImpl::getAttributes() const {return fNode.getAttributes (); }
|
||||
const XMLCh* DOMEntityImpl::getLocalName() const {return fNode.getLocalName (); }
|
||||
const XMLCh* DOMEntityImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); }
|
||||
DOMNode* DOMEntityImpl::getNextSibling() const {return fNode.getNextSibling (); }
|
||||
const XMLCh* DOMEntityImpl::getNodeValue() const {return fNode.getNodeValue (); }
|
||||
DOMDocument* DOMEntityImpl::getOwnerDocument() const {return fParent.fOwnerDocument; }
|
||||
const XMLCh* DOMEntityImpl::getPrefix() const {return fNode.getPrefix (); }
|
||||
DOMNode* DOMEntityImpl::getParentNode() const {return fNode.getParentNode (); }
|
||||
DOMNode* DOMEntityImpl::getPreviousSibling() const {return fNode.getPreviousSibling (); }
|
||||
DOMNode* DOMEntityImpl::insertBefore(DOMNode *newChild, DOMNode *refChild)
|
||||
{cloneEntityRefTree(); return fParent.insertBefore (newChild, refChild); }
|
||||
void DOMEntityImpl::normalize() {cloneEntityRefTree(); fParent.normalize (); }
|
||||
DOMNode* DOMEntityImpl::removeChild(DOMNode *oldChild) {cloneEntityRefTree(); return fParent.removeChild (oldChild); }
|
||||
DOMNode* DOMEntityImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild)
|
||||
{cloneEntityRefTree(); return fParent.replaceChild (newChild, oldChild); }
|
||||
bool DOMEntityImpl::isSupported(const XMLCh *feature, const XMLCh *version) const
|
||||
{return fNode.isSupported (feature, version); }
|
||||
void DOMEntityImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); }
|
||||
bool DOMEntityImpl::hasAttributes() const {return fNode.hasAttributes(); }
|
||||
bool DOMEntityImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); }
|
||||
bool DOMEntityImpl::isEqualNode(const DOMNode* arg) const {cloneEntityRefTree(); return fParent.isEqualNode(arg); }
|
||||
void* DOMEntityImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler)
|
||||
{return fNode.setUserData(key, data, handler); }
|
||||
void* DOMEntityImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); }
|
||||
short DOMEntityImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); }
|
||||
const XMLCh* DOMEntityImpl::getTextContent() const {return fNode.getTextContent(); }
|
||||
void DOMEntityImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); }
|
||||
const XMLCh* DOMEntityImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); }
|
||||
bool DOMEntityImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); }
|
||||
const XMLCh* DOMEntityImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); }
|
||||
void* DOMEntityImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); }
|
||||
|
||||
|
||||
//Introduced in DOM Level 3
|
||||
const XMLCh* DOMEntityImpl::getInputEncoding() const {
|
||||
return fInputEncoding;
|
||||
}
|
||||
|
||||
void DOMEntityImpl::setInputEncoding(const XMLCh* actualEncoding){
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument;
|
||||
fInputEncoding = doc->cloneString(actualEncoding);
|
||||
}
|
||||
|
||||
const XMLCh* DOMEntityImpl::getXmlEncoding() const {
|
||||
return fXmlEncoding;
|
||||
}
|
||||
|
||||
void DOMEntityImpl::setXmlEncoding(const XMLCh* encoding){
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument;
|
||||
fXmlEncoding = doc->cloneString(encoding);
|
||||
}
|
||||
|
||||
const XMLCh* DOMEntityImpl::getXmlVersion() const {
|
||||
return fXmlVersion;
|
||||
}
|
||||
|
||||
void DOMEntityImpl::setXmlVersion(const XMLCh* version){
|
||||
DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument;
|
||||
fXmlVersion = doc->cloneString(version);
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMEntityImpl.hpp 641193 2008-03-26 08:06:57Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMENTITYIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMENTITYIMPL_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include "DOMNodeImpl.hpp"
|
||||
#include "DOMParentNode.hpp"
|
||||
#include <xercesc/dom/DOMEntity.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class DOMEntityReference;
|
||||
|
||||
class CDOM_EXPORT DOMEntityImpl: public DOMEntity {
|
||||
protected:
|
||||
DOMNodeImpl fNode;
|
||||
DOMParentNode fParent;
|
||||
|
||||
const XMLCh * fName;
|
||||
const XMLCh * fPublicId;
|
||||
const XMLCh * fSystemId;
|
||||
const XMLCh * fNotationName;
|
||||
DOMEntityReference* fRefEntity;
|
||||
|
||||
// New data introduced in DOM Level 3
|
||||
const XMLCh* fInputEncoding;
|
||||
const XMLCh* fXmlEncoding;
|
||||
const XMLCh* fXmlVersion;
|
||||
const XMLCh* fBaseURI;
|
||||
bool fEntityRefNodeCloned;
|
||||
|
||||
// helper function
|
||||
void cloneEntityRefTree() const;
|
||||
|
||||
friend class XercesDOMParser;
|
||||
|
||||
public:
|
||||
DOMEntityImpl(DOMDocument *doc, const XMLCh *eName);
|
||||
DOMEntityImpl(const DOMEntityImpl &other, bool deep=false);
|
||||
virtual ~DOMEntityImpl();
|
||||
|
||||
public:
|
||||
// Declare all of the functions from DOMNode.
|
||||
DOMNODE_FUNCTIONS;
|
||||
|
||||
public:
|
||||
virtual const XMLCh * getPublicId() const;
|
||||
virtual const XMLCh * getSystemId() const;
|
||||
virtual const XMLCh * getNotationName() const;
|
||||
virtual void setNotationName(const XMLCh *arg);
|
||||
virtual void setPublicId(const XMLCh *arg);
|
||||
virtual void setSystemId(const XMLCh *arg);
|
||||
|
||||
//DOM Level 2 additions. Non standard functions
|
||||
virtual void setEntityRef(DOMEntityReference *);
|
||||
virtual DOMEntityReference* getEntityRef() const;
|
||||
|
||||
//Introduced in DOM Level 3
|
||||
virtual const XMLCh* getInputEncoding() const;
|
||||
virtual const XMLCh* getXmlEncoding() const;
|
||||
virtual const XMLCh* getXmlVersion() const;
|
||||
virtual void setBaseURI(const XMLCh *arg);
|
||||
|
||||
void setInputEncoding(const XMLCh* actualEncoding);
|
||||
void setXmlEncoding(const XMLCh* encoding);
|
||||
void setXmlVersion(const XMLCh* version);
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMEntityImpl & operator = (const DOMEntityImpl &);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMEntityReferenceImpl.cpp 678381 2008-07-21 10:15:01Z borisk $
|
||||
*/
|
||||
|
||||
#include "DOMDocumentImpl.hpp"
|
||||
#include "DOMDocumentTypeImpl.hpp"
|
||||
#include "DOMEntityImpl.hpp"
|
||||
#include "DOMEntityReferenceImpl.hpp"
|
||||
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
#include <xercesc/dom/DOMNode.hpp>
|
||||
#include <xercesc/dom/DOMNamedNodeMap.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
DOMEntityReferenceImpl::DOMEntityReferenceImpl(DOMDocument *ownerDoc,
|
||||
const XMLCh *entityName)
|
||||
: fNode(ownerDoc), fParent(ownerDoc), fBaseURI(0)
|
||||
{
|
||||
fName = ((DOMDocumentImpl*)fParent.fOwnerDocument)->getPooledString(entityName);
|
||||
// EntityReference behaves as a read-only node, since its contents
|
||||
// reflect the Entity it refers to -- but see setNodeName().
|
||||
//retrieve the corresponding entity content
|
||||
|
||||
if (ownerDoc) {
|
||||
if (ownerDoc->getDoctype()) {
|
||||
if (ownerDoc->getDoctype()->getEntities()) {
|
||||
DOMEntityImpl* entity = (DOMEntityImpl*)ownerDoc->getDoctype()->getEntities()->getNamedItem(entityName);
|
||||
if (entity) {
|
||||
fBaseURI = entity->getBaseURI();
|
||||
DOMEntityReference* refEntity = entity->getEntityRef();
|
||||
if (refEntity) {
|
||||
fParent.cloneChildren(refEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fNode.setReadOnly(true, true);
|
||||
}
|
||||
|
||||
|
||||
DOMEntityReferenceImpl::DOMEntityReferenceImpl(DOMDocument *ownerDoc,
|
||||
const XMLCh *entityName,
|
||||
bool cloneChild)
|
||||
: fNode(ownerDoc), fParent(ownerDoc), fBaseURI(0)
|
||||
{
|
||||
fName = ((DOMDocumentImpl*)fParent.fOwnerDocument)->getPooledString(entityName);
|
||||
// EntityReference behaves as a read-only node, since its contents
|
||||
// reflect the Entity it refers to -- but see setNodeName().
|
||||
//retrieve the corresponding entity content
|
||||
|
||||
if (ownerDoc) {
|
||||
if (ownerDoc->getDoctype()) {
|
||||
if (ownerDoc->getDoctype()->getEntities()) {
|
||||
DOMEntityImpl* entity = (DOMEntityImpl*)ownerDoc->getDoctype()->getEntities()->getNamedItem(entityName);
|
||||
if (entity) {
|
||||
fBaseURI = entity->getBaseURI();
|
||||
if (cloneChild) {
|
||||
DOMEntityReference* refEntity = entity->getEntityRef();
|
||||
if (refEntity) {
|
||||
fParent.cloneChildren(refEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fNode.setReadOnly(true, true);
|
||||
}
|
||||
|
||||
DOMEntityReferenceImpl::DOMEntityReferenceImpl(const DOMEntityReferenceImpl &other,
|
||||
bool deep)
|
||||
: DOMEntityReference(other),
|
||||
fNode(other.fNode),
|
||||
fParent(other.fParent),
|
||||
fChild(other.fChild),
|
||||
fName(other.fName),
|
||||
fBaseURI(other.fBaseURI)
|
||||
{
|
||||
if (deep)
|
||||
fParent.cloneChildren(&other);
|
||||
fNode.setReadOnly(true, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
DOMEntityReferenceImpl::~DOMEntityReferenceImpl()
|
||||
{
|
||||
}
|
||||
|
||||
DOMNode *DOMEntityReferenceImpl::cloneNode(bool deep) const
|
||||
{
|
||||
DOMNode* newNode = new (fParent.fOwnerDocument, DOMMemoryManager::ENTITY_REFERENCE_OBJECT) DOMEntityReferenceImpl(*this, deep);
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
|
||||
return newNode;
|
||||
}
|
||||
|
||||
|
||||
const XMLCh * DOMEntityReferenceImpl::getNodeName() const
|
||||
{
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
DOMNode::NodeType DOMEntityReferenceImpl::getNodeType() const {
|
||||
return DOMNode::ENTITY_REFERENCE_NODE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* EntityReferences never have a nodeValue.
|
||||
* @throws DOMException(NO_MODIFICATION_ALLOWED_ERR)
|
||||
*/
|
||||
void DOMEntityReferenceImpl::setNodeValue(const XMLCh *x)
|
||||
{
|
||||
fNode.setNodeValue(x);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* EntityRef is already, and must be, a read-only node. Attempts to change
|
||||
* that will throw a NO_MODIFICATION_ALLOWED_ERR DOMException.
|
||||
* <P>
|
||||
* If you want to alter its contents, edit the Entity definition.
|
||||
*
|
||||
* @param readOnly boolean
|
||||
*/
|
||||
void DOMEntityReferenceImpl::setReadOnly(bool readOnl,bool deep)
|
||||
{
|
||||
if(((DOMDocumentImpl *)fParent.fOwnerDocument)->getErrorChecking() && readOnl==false)
|
||||
throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
|
||||
fNode.setReadOnly(readOnl,deep);
|
||||
}
|
||||
|
||||
|
||||
void DOMEntityReferenceImpl::release()
|
||||
{
|
||||
if (fNode.isOwned() && !fNode.isToBeReleased())
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
|
||||
DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument;
|
||||
if (doc) {
|
||||
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
|
||||
fParent.release();
|
||||
doc->release(this, DOMMemoryManager::ENTITY_REFERENCE_OBJECT);
|
||||
}
|
||||
else {
|
||||
// shouldn't reach here
|
||||
throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
|
||||
}
|
||||
}
|
||||
|
||||
const XMLCh* DOMEntityReferenceImpl::getBaseURI() const
|
||||
{
|
||||
return fBaseURI;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Delegate functions from Node to the appropriate implementation.
|
||||
//
|
||||
|
||||
|
||||
DOMNode* DOMEntityReferenceImpl::appendChild(DOMNode *newChild) {return fParent.appendChild (newChild); }
|
||||
DOMNamedNodeMap* DOMEntityReferenceImpl::getAttributes() const {return fNode.getAttributes (); }
|
||||
DOMNodeList* DOMEntityReferenceImpl::getChildNodes() const {return fParent.getChildNodes (); }
|
||||
DOMNode* DOMEntityReferenceImpl::getFirstChild() const {return fParent.getFirstChild (); }
|
||||
DOMNode* DOMEntityReferenceImpl::getLastChild() const {return fParent.getLastChild (); }
|
||||
const XMLCh* DOMEntityReferenceImpl::getLocalName() const {return fNode.getLocalName (); }
|
||||
const XMLCh* DOMEntityReferenceImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); }
|
||||
DOMNode* DOMEntityReferenceImpl::getNextSibling() const {return fChild.getNextSibling (); }
|
||||
const XMLCh* DOMEntityReferenceImpl::getNodeValue() const {return fNode.getNodeValue (); }
|
||||
DOMDocument* DOMEntityReferenceImpl::getOwnerDocument() const {return fParent.fOwnerDocument; }
|
||||
const XMLCh* DOMEntityReferenceImpl::getPrefix() const {return fNode.getPrefix (); }
|
||||
DOMNode* DOMEntityReferenceImpl::getParentNode() const {return fChild.getParentNode (this); }
|
||||
DOMNode* DOMEntityReferenceImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); }
|
||||
bool DOMEntityReferenceImpl::hasChildNodes() const {return fParent.hasChildNodes (); }
|
||||
DOMNode* DOMEntityReferenceImpl::insertBefore(DOMNode *newChild, DOMNode *refChild)
|
||||
{return fParent.insertBefore (newChild, refChild); }
|
||||
void DOMEntityReferenceImpl::normalize() {fParent.normalize (); }
|
||||
DOMNode* DOMEntityReferenceImpl::removeChild(DOMNode *oldChild) {return fParent.removeChild (oldChild); }
|
||||
DOMNode* DOMEntityReferenceImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild)
|
||||
{return fParent.replaceChild (newChild, oldChild); }
|
||||
bool DOMEntityReferenceImpl::isSupported(const XMLCh *feature, const XMLCh *version) const
|
||||
{return fNode.isSupported (feature, version); }
|
||||
void DOMEntityReferenceImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); }
|
||||
bool DOMEntityReferenceImpl::hasAttributes() const {return fNode.hasAttributes(); }
|
||||
bool DOMEntityReferenceImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); }
|
||||
bool DOMEntityReferenceImpl::isEqualNode(const DOMNode* arg) const {return fParent.isEqualNode(arg); }
|
||||
void* DOMEntityReferenceImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler)
|
||||
{return fNode.setUserData(key, data, handler); }
|
||||
void* DOMEntityReferenceImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); }
|
||||
short DOMEntityReferenceImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); }
|
||||
const XMLCh* DOMEntityReferenceImpl::getTextContent() const {return fNode.getTextContent(); }
|
||||
void DOMEntityReferenceImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); }
|
||||
const XMLCh* DOMEntityReferenceImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); }
|
||||
bool DOMEntityReferenceImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); }
|
||||
const XMLCh* DOMEntityReferenceImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); }
|
||||
void* DOMEntityReferenceImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); }
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMEntityReferenceImpl.hpp 641193 2008-03-26 08:06:57Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMENTITYREFERENCEIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMENTITYREFERENCEIMPL_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMEntityReference.hpp>
|
||||
|
||||
#include "DOMParentNode.hpp"
|
||||
#include "DOMChildNode.hpp"
|
||||
#include "DOMNodeImpl.hpp"
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class CDOM_EXPORT DOMEntityReferenceImpl: public DOMEntityReference
|
||||
{
|
||||
protected:
|
||||
DOMNodeImpl fNode;
|
||||
DOMParentNode fParent;
|
||||
DOMChildNode fChild;
|
||||
|
||||
const XMLCh *fName;
|
||||
const XMLCh *fBaseURI;
|
||||
|
||||
friend class XercesDOMParser;
|
||||
|
||||
public:
|
||||
DOMEntityReferenceImpl(DOMDocument *ownerDoc, const XMLCh *entityName);
|
||||
DOMEntityReferenceImpl(DOMDocument *ownerDoc, const XMLCh *entityName, bool cloneChild);
|
||||
DOMEntityReferenceImpl(const DOMEntityReferenceImpl &other, bool deep=false);
|
||||
virtual ~DOMEntityReferenceImpl();
|
||||
|
||||
public:
|
||||
// Declare all of the functions from DOMNode.
|
||||
DOMNODE_FUNCTIONS;
|
||||
|
||||
public:
|
||||
virtual void setReadOnly(bool readOnly,bool deep);
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
DOMEntityReferenceImpl & operator = (const DOMEntityReferenceImpl &);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMErrorImpl.cpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#include "DOMErrorImpl.hpp"
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
#include <xercesc/dom/DOMLocator.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// DOMErrorImpl: Constructors and Destructor
|
||||
// ---------------------------------------------------------------------------
|
||||
DOMErrorImpl::DOMErrorImpl(const ErrorSeverity severity) :
|
||||
fAdoptLocation(false)
|
||||
, fSeverity(severity)
|
||||
, fMessage(0)
|
||||
, fLocation(0)
|
||||
, fType(0)
|
||||
, fRelatedData(0)
|
||||
{
|
||||
}
|
||||
|
||||
DOMErrorImpl::DOMErrorImpl(const ErrorSeverity severity,
|
||||
const XMLCh* const message,
|
||||
DOMLocator* const location) :
|
||||
fAdoptLocation(false)
|
||||
, fSeverity(severity)
|
||||
, fMessage(message)
|
||||
, fLocation(location)
|
||||
, fType(0)
|
||||
, fRelatedData(0)
|
||||
{
|
||||
}
|
||||
|
||||
DOMErrorImpl::DOMErrorImpl(const ErrorSeverity severity,
|
||||
const XMLCh* type,
|
||||
const XMLCh* message,
|
||||
void* relatedData) :
|
||||
fAdoptLocation(false)
|
||||
, fSeverity(severity)
|
||||
, fMessage(message)
|
||||
, fLocation(0)
|
||||
, fType(type)
|
||||
, fRelatedData(relatedData)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
DOMErrorImpl::~DOMErrorImpl()
|
||||
{
|
||||
if (fAdoptLocation)
|
||||
delete fLocation;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// DOMErrorImpl: Setter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
void DOMErrorImpl::setLocation(DOMLocator* const location)
|
||||
{
|
||||
if (fAdoptLocation)
|
||||
delete fLocation;
|
||||
|
||||
fLocation = location;
|
||||
}
|
||||
|
||||
void DOMErrorImpl::setRelatedException(void*) const
|
||||
{
|
||||
throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMErrorImpl.hpp 676853 2008-07-15 09:58:05Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMERRORIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMERRORIMPL_HPP
|
||||
|
||||
#include <xercesc/dom/DOMError.hpp>
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* Introduced in DOM Level 3
|
||||
* Implementation of a DOMError interface.
|
||||
*
|
||||
* @see DOMError#DOMError
|
||||
*/
|
||||
|
||||
class CDOM_EXPORT DOMErrorImpl : public DOMError
|
||||
{
|
||||
public:
|
||||
/** @name Constructors and Destructor */
|
||||
//@{
|
||||
|
||||
/** Constructors */
|
||||
DOMErrorImpl(const ErrorSeverity severity);
|
||||
|
||||
DOMErrorImpl
|
||||
(
|
||||
const ErrorSeverity severity
|
||||
, const XMLCh* const message
|
||||
, DOMLocator* const location
|
||||
);
|
||||
|
||||
DOMErrorImpl
|
||||
(
|
||||
const ErrorSeverity severity
|
||||
, const XMLCh* type
|
||||
, const XMLCh* message
|
||||
, void* relatedData
|
||||
);
|
||||
|
||||
/** Desctructor */
|
||||
virtual ~DOMErrorImpl();
|
||||
|
||||
//@}
|
||||
|
||||
// DOMError interface
|
||||
virtual ErrorSeverity getSeverity() const;
|
||||
virtual const XMLCh* getMessage() const;
|
||||
virtual DOMLocator* getLocation() const;
|
||||
virtual void* getRelatedException() const;
|
||||
virtual const XMLCh* getType() const;
|
||||
virtual void* getRelatedData() const;
|
||||
|
||||
// Setters
|
||||
void setSeverity(const ErrorSeverity severity);
|
||||
void setMessage(const XMLCh* const message);
|
||||
void setLocation(DOMLocator* const location);
|
||||
void setAdoptLocation(const bool value);
|
||||
void setRelatedException(void* exc) const;
|
||||
void setType(const XMLCh* type);
|
||||
void setRelatedData(void* relatedData);
|
||||
|
||||
private:
|
||||
/* Unimplemented constructors and operators */
|
||||
|
||||
/* Copy constructor */
|
||||
DOMErrorImpl(const DOMErrorImpl&);
|
||||
|
||||
/* Assignment operator */
|
||||
DOMErrorImpl& operator=(const DOMErrorImpl&);
|
||||
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
//
|
||||
// fAdoptLocation
|
||||
// Indicates whether we own the DOMLocator object or not.
|
||||
//
|
||||
// fSeverity
|
||||
// The type of the error.
|
||||
//
|
||||
// fMessage
|
||||
// The error message.
|
||||
//
|
||||
// fLocation
|
||||
// The location info of the error.
|
||||
//
|
||||
// fType
|
||||
// The type of the error.
|
||||
//
|
||||
// fRelatedData
|
||||
// The data related to this error.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
bool fAdoptLocation;
|
||||
ErrorSeverity fSeverity;
|
||||
const XMLCh* fMessage;
|
||||
DOMLocator* fLocation;
|
||||
const XMLCh* fType;
|
||||
void* fRelatedData;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// DOMErrorImpl: Getter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline DOMError::ErrorSeverity DOMErrorImpl::getSeverity() const
|
||||
{
|
||||
return fSeverity;
|
||||
}
|
||||
|
||||
inline const XMLCh* DOMErrorImpl::getMessage() const
|
||||
{
|
||||
return fMessage;
|
||||
}
|
||||
|
||||
inline DOMLocator* DOMErrorImpl::getLocation() const
|
||||
{
|
||||
return fLocation;
|
||||
}
|
||||
|
||||
inline void* DOMErrorImpl::getRelatedException() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline const XMLCh* DOMErrorImpl::getType() const
|
||||
{
|
||||
return fType;
|
||||
}
|
||||
|
||||
inline void* DOMErrorImpl::getRelatedData() const
|
||||
{
|
||||
return fRelatedData;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// DOMErrorImpl: Setter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline void DOMErrorImpl::setSeverity(const ErrorSeverity severity)
|
||||
{
|
||||
fSeverity = severity;
|
||||
}
|
||||
|
||||
inline void DOMErrorImpl::setMessage(const XMLCh* const message)
|
||||
{
|
||||
fMessage = message;
|
||||
}
|
||||
|
||||
inline void DOMErrorImpl::setAdoptLocation(const bool value)
|
||||
{
|
||||
fAdoptLocation = value;
|
||||
}
|
||||
|
||||
inline void DOMErrorImpl::setType(const XMLCh* type)
|
||||
{
|
||||
fType = type;
|
||||
}
|
||||
|
||||
inline void DOMErrorImpl::setRelatedData(void* relatedData)
|
||||
{
|
||||
fRelatedData = relatedData;
|
||||
}
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,291 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMImplementationImpl.cpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#include "DOMImplementationImpl.hpp"
|
||||
#include "DOMDocumentImpl.hpp"
|
||||
#include "DOMDocumentTypeImpl.hpp"
|
||||
#include "DOMLSSerializerImpl.hpp"
|
||||
#include "DOMLSInputImpl.hpp"
|
||||
#include "DOMLSOutputImpl.hpp"
|
||||
#include "DOMImplementationListImpl.hpp"
|
||||
|
||||
#include <xercesc/dom/DOMDocument.hpp>
|
||||
#include <xercesc/dom/DOMDocumentType.hpp>
|
||||
#include <xercesc/dom/DOMException.hpp>
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/util/XMLInitializer.hpp>
|
||||
#include <xercesc/util/XMLUniDefs.hpp>
|
||||
#include <xercesc/util/XMLChar.hpp>
|
||||
#include <xercesc/util/XMLStringTokenizer.hpp>
|
||||
#include <xercesc/util/XMLDOMMsg.hpp>
|
||||
#include <xercesc/util/XMLMsgLoader.hpp>
|
||||
#include <xercesc/parsers/DOMLSParserImpl.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Static constants
|
||||
// ------------------------------------------------------------
|
||||
static const XMLCh g1_0[] = // Points to "1.0"
|
||||
{chDigit_1, chPeriod, chDigit_0, chNull};
|
||||
static const XMLCh g2_0[] = // Points to "2.0"
|
||||
{chDigit_2, chPeriod, chDigit_0, chNull};
|
||||
static const XMLCh g3_0[] = // Points to "3.0"
|
||||
{chDigit_3, chPeriod, chDigit_0, chNull};
|
||||
static const XMLCh gTrav[] = // Points to "Traversal"
|
||||
{chLatin_T, chLatin_r, chLatin_a, chLatin_v, chLatin_e, chLatin_r,
|
||||
chLatin_s, chLatin_a, chLatin_l, chNull};
|
||||
static const XMLCh gCore[] = // Points to "Core"
|
||||
{chLatin_C, chLatin_o, chLatin_r, chLatin_e, chNull};
|
||||
static const XMLCh gRange[] = // Points to "Range"
|
||||
{chLatin_R, chLatin_a, chLatin_n, chLatin_g, chLatin_e, chNull};
|
||||
static const XMLCh gLS[] = // Points to "LS"
|
||||
{chLatin_L, chLatin_S, chNull};
|
||||
static const XMLCh gXPath[] = // Points to "XPath"
|
||||
{chLatin_X, chLatin_P, chLatin_a, chLatin_t, chLatin_h, chNull};
|
||||
|
||||
|
||||
static XMLMsgLoader *sMsgLoader = 0;
|
||||
static DOMImplementationImpl *gDomimp = 0;
|
||||
|
||||
void XMLInitializer::initializeDOMImplementationImpl()
|
||||
{
|
||||
sMsgLoader = XMLPlatformUtils::loadMsgSet(XMLUni::fgXMLDOMMsgDomain);
|
||||
|
||||
if (!sMsgLoader)
|
||||
XMLPlatformUtils::panic(PanicHandler::Panic_CantLoadMsgDomain);
|
||||
|
||||
gDomimp = new DOMImplementationImpl;
|
||||
}
|
||||
|
||||
void XMLInitializer::terminateDOMImplementationImpl()
|
||||
{
|
||||
delete gDomimp;
|
||||
gDomimp = 0;
|
||||
|
||||
delete sMsgLoader;
|
||||
sMsgLoader = 0;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
XMLMsgLoader* DOMImplementationImpl::getMsgLoader4DOM()
|
||||
{
|
||||
return sMsgLoader;
|
||||
}
|
||||
|
||||
DOMImplementationImpl *DOMImplementationImpl::getDOMImplementationImpl()
|
||||
{
|
||||
return gDomimp;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// DOMImplementation Virtual interface
|
||||
// ------------------------------------------------------------
|
||||
bool DOMImplementationImpl::hasFeature(const XMLCh * feature, const XMLCh * version) const
|
||||
{
|
||||
if (!feature)
|
||||
return false;
|
||||
|
||||
// ignore the + modifier
|
||||
if(*feature==chPlus)
|
||||
feature++;
|
||||
|
||||
bool anyVersion = (version == 0 || !*version);
|
||||
bool version1_0 = XMLString::equals(version, g1_0);
|
||||
bool version2_0 = XMLString::equals(version, g2_0);
|
||||
bool version3_0 = XMLString::equals(version, g3_0);
|
||||
|
||||
// Currently, we support only XML Level 1 version 1.0
|
||||
if (XMLString::compareIStringASCII(feature, XMLUni::fgXMLString) == 0
|
||||
&& (anyVersion || version1_0 || version2_0))
|
||||
return true;
|
||||
|
||||
if (XMLString::compareIStringASCII(feature, gCore) == 0
|
||||
&& (anyVersion || version1_0 || version2_0 || version3_0))
|
||||
return true;
|
||||
|
||||
if (XMLString::compareIStringASCII(feature, gTrav) == 0
|
||||
&& (anyVersion || version2_0))
|
||||
return true;
|
||||
|
||||
if (XMLString::compareIStringASCII(feature, gRange) == 0
|
||||
&& (anyVersion || version2_0))
|
||||
return true;
|
||||
|
||||
if (XMLString::compareIStringASCII(feature, gLS) == 0
|
||||
&& (anyVersion || version3_0))
|
||||
return true;
|
||||
|
||||
if (XMLString::compareIStringASCII(feature, gXPath) == 0
|
||||
&& (anyVersion || version3_0))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//Introduced in DOM Level 2
|
||||
DOMDocumentType *DOMImplementationImpl::createDocumentType(const XMLCh *qualifiedName,
|
||||
const XMLCh * publicId, const XMLCh *systemId)
|
||||
{
|
||||
// assume XML 1.0 since we do not know its version yet.
|
||||
if(!XMLChar1_0::isValidName(qualifiedName))
|
||||
throw DOMException(DOMException::INVALID_CHARACTER_ERR, 0);
|
||||
|
||||
//to do: do we need to create with user's memorymanager???
|
||||
DOMDocumentTypeImpl* docType = new DOMDocumentTypeImpl(0, qualifiedName, publicId, systemId, true);
|
||||
return docType;
|
||||
}
|
||||
|
||||
DOMDocument *DOMImplementationImpl::createDocument(const XMLCh *namespaceURI,
|
||||
const XMLCh *qualifiedName, DOMDocumentType *doctype,
|
||||
MemoryManager* const manager)
|
||||
{
|
||||
return new (manager) DOMDocumentImpl(namespaceURI, qualifiedName, doctype, this, manager);
|
||||
}
|
||||
|
||||
|
||||
//Introduced in DOM Level 3
|
||||
void* DOMImplementationImpl::getFeature(const XMLCh*, const XMLCh*) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Non-standard extension
|
||||
DOMDocument *DOMImplementationImpl::createDocument(MemoryManager* const manager)
|
||||
{
|
||||
return new (manager) DOMDocumentImpl(this, manager);
|
||||
}
|
||||
|
||||
//
|
||||
// DOMImplementation::getImplementation. DOMImplementation is supposed to
|
||||
// be a pure interface class. This one static
|
||||
// function is the hook that lets things get started.
|
||||
DOMImplementation *DOMImplementation::getImplementation()
|
||||
{
|
||||
return (DOMImplementation*) DOMImplementationImpl::getDOMImplementationImpl();
|
||||
}
|
||||
|
||||
bool DOMImplementation::loadDOMExceptionMsg
|
||||
(
|
||||
const short msgToLoad
|
||||
, XMLCh* const toFill
|
||||
, const XMLSize_t maxChars
|
||||
)
|
||||
{
|
||||
// Figure out which exception range this code is and load the corresponding
|
||||
// message.
|
||||
//
|
||||
if (msgToLoad <= 50)
|
||||
{
|
||||
// DOMException
|
||||
return sMsgLoader->loadMsg(XMLDOMMsg::DOMEXCEPTION_ERRX+msgToLoad, toFill, maxChars);
|
||||
}
|
||||
else if (msgToLoad <= 80)
|
||||
{
|
||||
// DOMXPathException
|
||||
return sMsgLoader->loadMsg(XMLDOMMsg::DOMXPATHEXCEPTION_ERRX+msgToLoad-DOMXPathException::INVALID_EXPRESSION_ERR+1, toFill, maxChars);
|
||||
}
|
||||
else if (msgToLoad <= 110)
|
||||
{
|
||||
// DOMXLSException
|
||||
return sMsgLoader->loadMsg(XMLDOMMsg::DOMLSEXCEPTION_ERRX+msgToLoad-DOMLSException::PARSE_ERR+1, toFill, maxChars);
|
||||
}
|
||||
else
|
||||
{
|
||||
// DOMRangeException
|
||||
return sMsgLoader->loadMsg(XMLDOMMsg::DOMRANGEEXCEPTION_ERRX+msgToLoad-DOMRangeException::BAD_BOUNDARYPOINTS_ERR+1, toFill, maxChars);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// DOMImplementationLS Virtual interface
|
||||
// ------------------------------------------------------------
|
||||
//Introduced in DOM Level 3
|
||||
DOMLSParser* DOMImplementationImpl::createLSParser( const DOMImplementationLSMode mode,
|
||||
const XMLCh* const /*schemaType*/,
|
||||
MemoryManager* const manager,
|
||||
XMLGrammarPool* const gramPool)
|
||||
{
|
||||
if (mode == DOMImplementationLS::MODE_ASYNCHRONOUS)
|
||||
throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, manager);
|
||||
|
||||
// TODO: schemaType
|
||||
return new (manager) DOMLSParserImpl(0, manager, gramPool);
|
||||
}
|
||||
|
||||
|
||||
DOMLSSerializer* DOMImplementationImpl::createLSSerializer(MemoryManager* const manager)
|
||||
{
|
||||
return new (manager) DOMLSSerializerImpl(manager);
|
||||
}
|
||||
|
||||
DOMLSInput* DOMImplementationImpl::createLSInput(MemoryManager* const manager)
|
||||
{
|
||||
return new (manager) DOMLSInputImpl(manager);
|
||||
}
|
||||
|
||||
DOMLSOutput* DOMImplementationImpl::createLSOutput(MemoryManager* const manager)
|
||||
{
|
||||
return new (manager) DOMLSOutputImpl(manager);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// DOMImplementationSource Virtual interface
|
||||
// ------------------------------------------------------------
|
||||
DOMImplementation* DOMImplementationImpl::getDOMImplementation(const XMLCh* features) const
|
||||
{
|
||||
DOMImplementation* impl = DOMImplementation::getImplementation();
|
||||
|
||||
XMLStringTokenizer tokenizer(features, XMLPlatformUtils::fgMemoryManager);
|
||||
const XMLCh* feature = 0;
|
||||
|
||||
while (feature || tokenizer.hasMoreTokens()) {
|
||||
|
||||
if (!feature)
|
||||
feature = tokenizer.nextToken();
|
||||
|
||||
const XMLCh* version = 0;
|
||||
const XMLCh* token = tokenizer.nextToken();
|
||||
|
||||
if (token && XMLString::isDigit(token[0]))
|
||||
version = token;
|
||||
|
||||
if (!impl->hasFeature(feature, version))
|
||||
return 0;
|
||||
|
||||
if (!version)
|
||||
feature = token;
|
||||
}
|
||||
return impl;
|
||||
}
|
||||
|
||||
DOMImplementationList* DOMImplementationImpl::getDOMImplementationList(const XMLCh* features) const
|
||||
{
|
||||
DOMImplementationListImpl* list = new DOMImplementationListImpl;
|
||||
DOMImplementation* myImpl=getDOMImplementation(features);
|
||||
if(myImpl)
|
||||
list->add(myImpl);
|
||||
return list;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMImplementationImpl.hpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONIMPL_HPP
|
||||
|
||||
//
|
||||
// This file is part of the internal implementation of the C++ XML DOM.
|
||||
// It should NOT be included or used directly by application programs.
|
||||
//
|
||||
// Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
||||
// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
||||
// name is substituded for the *.
|
||||
//
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMImplementation.hpp>
|
||||
#include <xercesc/dom/DOMImplementationSource.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLMsgLoader;
|
||||
|
||||
class DOMImplementationImpl: public XMemory,
|
||||
public DOMImplementation,
|
||||
public DOMImplementationSource
|
||||
{
|
||||
private:
|
||||
DOMImplementationImpl(const DOMImplementationImpl &);
|
||||
DOMImplementationImpl & operator = (const DOMImplementationImpl &);
|
||||
friend class XMLInitializer;
|
||||
|
||||
protected:
|
||||
DOMImplementationImpl() {};
|
||||
|
||||
public:
|
||||
virtual ~DOMImplementationImpl() {};
|
||||
static DOMImplementationImpl* getDOMImplementationImpl();
|
||||
static XMLMsgLoader* getMsgLoader4DOM();
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// DOMImplementation Virtual interface
|
||||
// ------------------------------------------------------------
|
||||
virtual bool hasFeature(const XMLCh * feature, const XMLCh * version) const;
|
||||
|
||||
// Introduced in DOM Level 2
|
||||
virtual DOMDocumentType* createDocumentType(const XMLCh *qualifiedName,
|
||||
const XMLCh * publicId,
|
||||
const XMLCh *systemId);
|
||||
virtual DOMDocument* createDocument(const XMLCh *namespaceURI,
|
||||
const XMLCh *qualifiedName,
|
||||
DOMDocumentType *doctype,
|
||||
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
// DOM Level 3
|
||||
virtual void* getFeature(const XMLCh* feature, const XMLCh* version) const;
|
||||
|
||||
// Non-standard extension
|
||||
virtual DOMDocument* createDocument(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// DOMImplementationLS Virtual interface
|
||||
// ------------------------------------------------------------
|
||||
// Introduced in DOM Level 3
|
||||
virtual DOMLSParser* createLSParser(const DOMImplementationLSMode mode,
|
||||
const XMLCh* const schemaType,
|
||||
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager,
|
||||
XMLGrammarPool* const gramPool = 0);
|
||||
virtual DOMLSSerializer* createLSSerializer(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
virtual DOMLSInput* createLSInput(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
virtual DOMLSOutput* createLSOutput(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// DOMImplementationSource Virtual interface
|
||||
// ------------------------------------------------------------
|
||||
virtual DOMImplementation* getDOMImplementation(const XMLCh* features) const;
|
||||
virtual DOMImplementationList* getDOMImplementationList(const XMLCh* features) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: DOMImplementationListImpl.cpp 671894 2008-06-26 13:29:21Z borisk $
|
||||
*/
|
||||
|
||||
#include "DOMImplementationListImpl.hpp"
|
||||
#include <xercesc/dom/DOMImplementation.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
DOMImplementationListImpl::DOMImplementationListImpl()
|
||||
{
|
||||
fList=new RefVectorOf<DOMImplementation>(3, false);
|
||||
}
|
||||
|
||||
|
||||
DOMImplementationListImpl:: ~DOMImplementationListImpl()
|
||||
{
|
||||
delete fList;
|
||||
}
|
||||
|
||||
|
||||
void DOMImplementationListImpl::add(DOMImplementation* impl) {
|
||||
fList->addElement(impl);
|
||||
}
|
||||
|
||||
XMLSize_t DOMImplementationListImpl::getLength() const{
|
||||
return fList->size();
|
||||
}
|
||||
|
||||
|
||||
DOMImplementation *DOMImplementationListImpl::item(XMLSize_t index) const
|
||||
{
|
||||
if(index<fList->size())
|
||||
return fList->elementAt(index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DOMImplementationListImpl::release() {
|
||||
delete this;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user