com.aspose.words
Class XmlMapping

java.lang.Object
    extended by com.aspose.words.XmlMapping
All Implemented Interfaces:
java.lang.Cloneable

public class XmlMapping 
extends java.lang.Object

Specifies the information that is used to establish a mapping between the parent structured document tag and an XML element stored within a custom XML data part in the document.

Property Getters/Setters Summary
CustomXmlPartgetCustomXmlPart()
           Returns the custom XML data part to which the parent structured document tag is mapped.
booleanisMapped()
           Returns true if the parent structured document tag is successfully mapped to XML data.
java.lang.StringgetPrefixMappings()
           Returns XML namespace prefix mappings to evaluate the XPath.
java.lang.StringgetStoreItemId()
           Specifies the custom XML data identifier for the custom XML data part which shall be used to evaluate the XPath expression.
java.lang.StringgetXPath()
           Returns the XPath expression, which is evaluated to find the custom XML node that is mapped to the parent structured document tag.
 
Method Summary
voiddelete()
           Deletes mapping of the parent structured document to XML data.
booleansetMapping(CustomXmlPart customXmlPart, java.lang.String xPath, java.lang.String prefixMapping)
           Sets a mapping between the parent structured document tag and an XML node of a custom XML data part.
 

Property Getters/Setters Detail

getCustomXmlPart

public CustomXmlPart getCustomXmlPart()
Returns the custom XML data part to which the parent structured document tag is mapped.

isMapped

public boolean isMapped()
Returns true if the parent structured document tag is successfully mapped to XML data.

getPrefixMappings

public java.lang.String getPrefixMappings()
Returns XML namespace prefix mappings to evaluate the XPath. Specifies the set of prefix mappings, which shall be used to interpret the XPath expression when the XPath expression is evaluated against the custom XML data parts in the document.

getStoreItemId

public java.lang.String getStoreItemId()
Specifies the custom XML data identifier for the custom XML data part which shall be used to evaluate the XPath expression.

getXPath

public java.lang.String getXPath()
Returns the XPath expression, which is evaluated to find the custom XML node that is mapped to the parent structured document tag.

Method Detail

delete

public void delete()
Deletes mapping of the parent structured document to XML data.

setMapping

public boolean setMapping(CustomXmlPart customXmlPart, java.lang.String xPath, java.lang.String prefixMapping)
                  throws java.lang.Exception
Sets a mapping between the parent structured document tag and an XML node of a custom XML data part.
Parameters:
customXmlPart - A custom XML data part to map to.
xPath - An XPath expression to find the XML node.
prefixMapping - XML namespace prefix mappings to evaluate the XPath.
Returns:
A flag indicating whether the parent structured document tag is successfully mapped to the XML node.

Example:

Shows how to create structured document tag with a custom XML data.
Document doc = new Document();
// Add test XML data part to the collection.
CustomXmlPart xmlPart = doc.getCustomXmlParts().add(UUID.randomUUID().toString(), "<root><text>Hello, World!</text></root>");

StructuredDocumentTag sdt = new StructuredDocumentTag(doc, SdtType.PLAIN_TEXT, MarkupLevel.BLOCK);
sdt.getXmlMapping().setMapping(xmlPart, "/root[1]/text[1]", "");

doc.getFirstSection().getBody().appendChild(sdt);

doc.save(getMyDir() + "\\Artifacts\\SDT.CustomXml.docx");

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.