Hi Marius,

None of the DOM operations will add PSVI to the nodes.

If you want to get PSVI, you need to set "psvi" [1] and "validate" features
and call "normalizeDocument" [2].

[1] http://xml.apache.org/xerces2-j/dom3.html
[2] http://xml.apache.org/xerces2-j/faq-dom.html#faq-7

Thank you,
--
Elena Litani/ IBM Toronto



Monday, December 01, 2003 6:17 PM
To: [EMAIL PROTECTED]
cc:
From: "Marius Gleeson" <[EMAIL PROTECTED]>
Subject: Addind nodes to a PSVI generated document



Hi there,

I am trying to add nodes that I have generated from xsl parsing to a
source document that was generated using PSVIDocumentImpl.

The problem is that the nodes I am adding do not have any schema
information attached ( They are however schematically correct ), and the
importNode or addChild methods do not attach this information either.
Basically I need something to revalidate these new nodes and attach there
respective Schema type.

public void commit(Node parent, Node child,
org.apache.xerces.xs.XSTypeDefinition type ) throws Exception {

  PSVIElementNSImpl nsEntity =
  (PSVIElementNSImpl)parent.getOwnerDocument().importNode(child,true);

  if (nsEntity.getTypeDefinition() == null) {
  nsEntity.setPSVI( /* Have no PSVIElement to pass in */ );
  /* I can set the type using the following but I cannot get this value
  back when I need it, because
       nsEntity.getTypeDefinition() method returns a different variable.
       Maybe the variable used in ElementNSImpl
       should also be used by PSVIElementNSImpl */
    nsEntity.setType( type );
    }
    /* what do I do about all the child nodes schema information ? */
    parent.appendChild(nsEntity);
}

Thanks,
Marius.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to