---
name: "XML::Compile::Schema::Instance"
section: "3pm"
platform: "linux"
package: "libxml-compile-perl"
version: "1.64-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/XML::Compile::Schema::Instance"
---

# XML::Compile::Schema::Instance(3pm)

Represents one schema

## NAME

XML::Compile::Schema::Instance - Represents one schema

## SYNOPSIS

```
 # Used internally by XML::Compile::Schema
 my $schema = XML::Compile::Schema::Instance->new($xml);
```

## DESCRIPTION

This module collect information from one schema, and helps to process it.

## METHODS

### Constructors

- $obj-\>**new**($top, %options)

  Gets the top of an XML::LibXML tree, which must be a schema element. The tree is parsed: the information collected.

  ```
   -Option                --Default
    attribute_form_default  <undef>
    element_form_default    <undef>
    filename                undef
    source                  undef
    target_namespace        <undef>
  ```

  - attribute\_form\_default =\> 'qualified'\|'unqualified'

    - element\_form\_default =\> 'qualified'\|'unqualified'

    Overrule the default as found in the schema.  Many old schemas (like WSDL11 and SOAP11) do not specify the default in the schema but only in the text.

  - filename =\> FILENAME

    When the source is some file, this is its name.

  - source =\> STRING

    An indication where this information came from.

  - target\_namespace =\> NAMESPACE

    Overrule or set the target namespace.

### Accessors

- $obj-\>**attributeGroups**()

  Returns a list of all defined attribute groups.

- $obj-\>**attributes**()

  Returns a lost of all globally defined attribute names.

- $obj-\>**complexTypes**()

  Returns a list with all complexType names.

- $obj-\>**element**($uri)

  Returns one global element definition.

- $obj-\>**elements**()

  Returns a list of all globally defined element names.

- $obj-\>**filename**()

  - $obj-\>**groups**()

  Returns a list of all defined model groups.

- $obj-\>**schema**()

  - $obj-\>**schemaInstance**()

  - $obj-\>**schemaNamespace**()

  - $obj-\>**sgs**()

  Returns a HASH with the base-type as key and an ARRAY of types which extend it.

- $obj-\>**simpleTypes**()

  Returns a list with all simpleType names.

- $obj-\>**source**()

  - $obj-\>**targetNamespace**()

  - $obj-\>**tnses**()

  A schema can defined more than one target namespace, where recent schema spec changes provide a targetNamespace attribute.

- $obj-\>**type**($uri)

  Returns the type definition with the specified name.

- $obj-\>**types**()

  Returns a list of all simpleTypes and complexTypes

### Index

- $obj-\>**find**($kind, $fullname)

  Returns the definition for the object of `$kind`, with `$fullname`.

  example: of find

  ```
    my $attr = $instance->find(attribute => '{myns}my_global_attr');
  ```

- $obj-\>**importLocations**($ns)

  Returns a list of all schemaLocations specified with the import `$ns` (one of the values returned by **imports()**).

- $obj-\>**imports**()

  Returns a list with all namespaces which need to be imported.

- $obj-\>**includeLocations**()

  Returns a list of all schemaLocations which where specified with include statements.

- $obj-\>**printIndex**( \[$fh\], %options )

  Prints an overview over the defined objects within this schema to the selected `$fh`.

  ```
   -Option       --Default
    kinds          <all>
    list_abstract  <true>
  ```

  - kinds =\> KIND\|ARRAY-of-KIND

    Which KIND of definitions would you like to see.  Pick from `"element"`, `"attribute"`, `"simpleType"`, `"complexType"`, `"attributeGroup"`, and `"group"`.

  - list\_abstract =\> BOOLEAN

    Show abstract elements, or skip them (because they cannot be instantiated anyway).

## SEE ALSO

This module is part of XML-Compile distribution version 1.64, built on October 21, 2024. Website: *http://perl.overmeer.net/xml-compile/*

## LICENSE

Copyrights 2006-2024 by \[Mark Overmeer \<markov@cpan.org\>\]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See *http://dev.perl.org/licenses/*
