XML — version history
A non-visual object that builds an XML document element by element and reads or modifies one with real XPath 1.0 — PowerBuilder 10 has no XML parser of its own. Introduced in 3.0.
4.0 — October 2026 #
New #
of_get_valueaccepts XPath value expressions —count(//line),sum(//@qty),boolean(…)— and returns the result as text (3,true).- A prefix declared lower than the root (a SOAP response) resolves without
of_register_namespace, and thexmlprefix is always bound (@xml:langis read). of_add_childandof_set_attraccept a prefixed name (xsi:type,p:item) in the namespace of that prefix;of_add_xmlgives the fragment the namespaces in force at its target, asof_add_childdoes.
Fixed #
- After building a document, reads and changes apply to that document (they used to act on the last loaded one, or on nothing); the next
of_start_elementstarts a new one. - A failed
of_load(empty, malformed) leaves nothing readable behind; a half-built document no longer stays inof_xml. of_xml,of_prettyandof_get_valuesreturn a large document in full instead of cutting it after a few MB.of_prettykeeps CDATA sections, comments, processing instructions and the XML declaration, keeps an element that holds text on one line, and keeps the prefix of an element added under a prefixed parent.- The builder writes documents that read back identically: line breaks and tabs in attributes, carriage returns in text; control characters are removed; an invalid element name is refused (
is_last_error) and the element left out; the same attribute set twice keeps one attribute with the second value. - A document that contains a
<parsererror>element loads normally; the error message of a malformed XML is the error line alone. of_removecounts nested nodes once, removes attributes, and never removes the root (of_clearempties a document);of_set_value("/")returns-4;of_add_childunder an attribute says "the node cannot have children".is_last_errorgives the real reason after an invalid XPath, an unanswered page or a refusal; a page that does not answer returns an empty value, not the textnull.of_closefollowed by a read keeps and reloads the loaded document;ipo_ownerset after the first read is taken into account at the next one.of_get_valueson thousands of nodes takes a time proportional to their number (5,000 values used to take several seconds).- The "Quick start" example of the documentation creates the object (
create n_pbt_xml) and frees it (destroy); as written it stopped on a null object reference.
Behavior changes #
See the 3.0 → 4.0 migration guide, sections 11.3 and 11.31.
of_transformis removed: XSLT is being withdrawn from the browser engine the component relies on. Transform on the server side, or in PowerScript.- A read (
of_exists,of_count,of_get_value,of_is_valid…) or a change while a built element is still open is refused —-4, empty orfalse, andis_last_error= "the document is still being built : close its elements first" — instead of silently losing the rest of the document;of_xmlandof_prettyremain allowed. of_removefollows the library's codes:-5for an empty XPath,-4with no loaded document,-2when the page does not answer; a count (>= 0) only when the removal was attempted.of_set_attr/of_add_childwith an undeclared prefix return-4and "undeclared prefix : …" instead of writing a document that no longer reloads.of_register_namespacerefuses an empty URI (-5);of_register_namespaceandof_clear_namespacesreturn-2when the page does not answer.of_openreturns-2when the page cannot be created;is_last_errorsays why.
3.0 — September 2026 #
New #
- First release: build a document with
of_start_element,of_element_attr,of_element_text,of_end_elementandof_leaf, escaping done for you, thenof_xml. - Read a document with real XPath 1.0 through the WebView2 engine, synchronously:
of_load,of_is_valid,of_exists,of_get_value,of_get_attr,of_count,of_name, and several nodes at once withof_get_values,of_get_attrs,of_get_attr_names. - Modify a loaded document in place:
of_set_value,of_set_attr,of_remove_attr,of_add_child,of_add_xml,of_remove;of_prettyfor an indented copy. - Namespaces (
of_register_namespace,of_clear_namespaces) and XSLT transformation (of_transform).